Jump to content

wik

Community Members
  • Posts

    26
  • Joined

  • Last visited

Posts posted by wik

  1. On 6/9/2020 at 6:09 PM, Stan` said:

    Thanks for pointing that out, I'll need to study it :)

    Meanwhile I've done some more experiments and noticed that if we only multiply glViewport components by scale factor, then mouse coordinates not affected.
    Previously I've tried to multiple ClientSize in OnResize and InitSize, but those broke mouse coordinates.

     

    void CRenderer::SetViewport(const SViewPort &vp)
    {
    	m_Viewport = vp;
    	const float scaleFactor = 2.f;
    	glViewport((GLint)vp.m_X * scaleFactor,(GLint)vp.m_Y * scaleFactor,(GLsizei)vp.m_Width * scaleFactor,(GLsizei)vp.m_Height * scaleFactor);
    }

    Looks a bit more promising IMHO, but still need to figure out how to get content scale factor in there.

    • Thanks 1
  2.  

    On 5/27/2020 at 9:16 AM, Nescio said:

    It probably has something to do with the fact I have a high resolution (3840×2160) and Atlas treats system settings differently than 0 A.D. @vladislavbelov taught me to use:

    
    GDK_SCALE=1 binaries/system/pyrogenesis -editor

    I haven't tried, but there seems to be similar solution for OSX, i.e. disable high dpi capability on per application basis:

    https://github.com/ioquake/ioq3/issues/422#issuecomment-541193050

    /Contents/Info.plist, right above the "" line:
    
    <key>NSHighResolutionCapable</key>
    <false/>

    Could be an intermediate option before transitioning to hdpi support.

  3. 14 hours ago, wik said:

    Note, I'm using SDL2-2.0.12 and the following commit could probably explain why game, unlike editor, running in 1:1 mode: https://hg.libsdl.org/SDL/rev/46b094f7d20e

    i.e. SDL overrides default behavior and the application treated as non hidpi compatible and running in 1:1 mode by default.

    I should probably give it a go with SDL2-2.0.5

    I've tried it with SDL2-2.0.5 (the version we currently have in trunk) https://github.com/0ad/0ad/blob/master/libraries/osx/build-osx-libs.sh#L27

    And it turns out that removing explicit call to glViewport allows game to scale automatically (2880 x 1800), below some examples with and without glViewport

    void CRenderer::SetViewport(const SViewPort &vp)
    {
    	m_Viewport = vp;
    	//glViewport((GLint)vp.m_X,(GLint)vp.m_Y,(GLsizei)vp.m_Width,(GLsizei)vp.m_Height);
    }

    With glViewport (m_Viewport m_Width X m_Height => 1440 x 900)

    302516027_Screenshot2020-06-09at16_57_45.thumb.png.62895fbfc369d4bae334981bb142af01.png

    Without glViewport (after commenting out the line, also glGetIntegerv(GL_VIEWPORT) reports 2880 x 1800)

    1562247117_Screenshot2020-06-09at17_00_19.thumb.png.449fa822a9e7d46aa284d11885e792ee.png

    But I've noticed that some text disappeared in "auto-scaled" version, perhaps something to do with fonts.

  4. I've done some more experiments with opengl examples from wxWidgets and it turns out that if we skip glViewport the system will sort it out automagically,

    i.e. scale factor will be applied and even mouse position will be adjusted transparently, wxWidgets will behave as it would run on any other screen

    // Renderer.cpp
    void CRenderer::SetViewport(const SViewPort &vp)
    {
    	m_Viewport = vp;
    	//glViewport((GLint)vp.m_X,(GLint)vp.m_Y,(GLsizei)vp.m_Width,(GLsizei)vp.m_Height);
    }

    I've tried to debug GL_VIEWPORT state with the following snippets

    int viewport[4];
    glGetIntegerv(GL_VIEWPORT, viewport);
    std::printf("m_Viewport %d x %d\n", m_Viewport.m_Width, m_Viewport.m_Height);
    std::printf("GL_VIEWPORT %d x %d\n", viewport[2], viewport[3]);

    Here is results:

    Editor: 
    m_Viewport 734 x 718
    GL_VIEWPORT 1468 x 1436

    Game:
    m_Viewport 1440 x 900 (also noticed that every 4th call to SetViewport has strange vp 2048 x 2048, i.e. something in 0ad game code tries to set this)
    GL_VIEWPORT 1440 x 900 (remains stable, I believe not scaled, probably because some magic in SDL update)

    Unfortunatelly I didn't find documentation about default behavior for glViewport and when it should or shouldn't be used explicitly.

     

    • Like 1
  5.  

    12 hours ago, wik said:

    still have offset between mouse pointer and place where it triggers action for some reason

    This is because scale factor need to applied to wxMouseEvent::GetPosition(), I found some clarification in wxWidgets documentation https://docs.wxwidgets.org/trunk/classwx_g_l_canvas.html

    Quote

    Please note that wxGLContext always uses physical pixels, even on the platforms where wxWindow uses logical pixels, affected by the coordinate scaling, on high DPI displays. Thus, if you want to set the OpenGL view port to the size of entire window, you must multiply the result returned by wxWindow::GetClientSize() by wxWindow::GetContentScaleFactor() before passing it to glViewport(). Same considerations apply to other OpenGL functions and other coordinates, notably those retrieved from wxMouseEvent in the event handlers.

    As an experiment I've tried to apply scale factor of 2.0 (retina) in AlterElevation tool

    POST_MESSAGE(BrushPreview, (true, Position(evt.GetPosition() * 2.0))); // multiplied by 2.0 (retina)

    Here is illustration, the mouse pointer, in both cases, in the middle (approx) of square 

    Before:

    975377609_Screenshot2020-05-30at04_17_46.thumb.png.1abcd0c0014b1107cb30010085b36cad.png

    After:

    1166049862_Screenshot2020-05-30at04_16_08.thumb.png.ae2cb70bf0e11d16d818b4501b0a965a.png

    It feels like "Position::Position(const wxPoint& pt)" definition from ScenarioEditor.cpp might be a good place to implement this uniformly.

    I also need to figure out how to get scale factor from wxPoint.

  6. On 5/28/2020 at 6:57 AM, wraitii said:

    Seems to me you've been sent from above to fix WxWidgets bugs, wik :D .

    If you want to, you can make a patch on Phabricator, see SubmittingPatches and Phabricator .

    Thanks, I'll try :)

    With those changes applied the map fills whole canvas, but I just noticed that it still have offset between mouse pointer and place where it triggers action for some reason. On non-retina display it only happens with my changes applied, so, I probably missing something.

    UPDATE: it only happens on retina display, if I move window to non-retina display it back to normal after resize (I keep forgetting to resize)

  7. Looks like it also helps with altas editor, if I multiply client size by scale factor GetContentScaleFactor():

    void Canvas::OnResize(wxSizeEvent&)
    {
    	// Be careful not to send 'resize' messages to the game before we've
    	// told it that this canvas exists
        if (! m_SuppressResize) {
            const wxSize ClientSize = GetClientSize() * GetContentScaleFactor();
    		POST_MESSAGE(ResizeScreen, (ClientSize.GetWidth(), ClientSize.GetHeight()));
    		// TODO: fix flashing
        }
    }
    
    void Canvas::InitSize()
    {
    	m_SuppressResize = false;
        const wxSize ClientSize = GetClientSize() * GetContentScaleFactor();
    	SetSize(ClientSize);
    }

    265910415_Screenshot2020-05-28at00_21_36.thumb.png.732dff537fb8004b66cc8c6b4a28ef98.png

  8. 5 hours ago, wraitii said:

    Can you delete text? In A23 it's also messed up

    @wraitii, yes, can delete text too, yay :)

    Also, Alt + Enter works, and even "full screen" green button works more as expected.

    6 hours ago, wraitii said:

    Can you input text if you "start'" the simulation?

    Yes, I can change text in the fields on the left side, also QE, WASD and other shortcuts works inside game simulation

    However I can't enter / change text in any text fields which appears as a part of game simulation, for example, user name in game options or message in the chat window.

  9. NOTE: I have the following patches applied:

    https://code.wildfiregames.com/D2752 - to run the editor on OSX

    https://code.wildfiregames.com/D2716 - to build libraries on OSX

    The problem

    Impossible to modify text in the input fields in the editor or navigate map using keyboard (WASD), however, all input remains on the terminal even though it looks like text field in in focus, see screenshot.

    397039681_Screenshot2020-05-26at13_40_12.thumb.png.8c710ad6dfa1cbcbce04e3d07bf2ae0f.png

     

    Initial research shows that this behavior caused by OSXIsGUIApplication in AtlasDLLApp

    class AtlasDLLApp : public wxApp
    {
    public:
    
    #ifdef __WXOSX__
    	virtual bool OSXIsGUIApplication()
    	{
    		return false;
    	}
    #endif

    Changing it to "return true" fixes issue, i.e. I can edit text and use keyboard to navigate the map.

    1406386811_Screenshot2020-05-26at14_06_32.thumb.png.0ddc4851df2d3cfa6a1a70e9aa72846a.png

    I also tested OSXIsGUIApplication behavior with libraries/osx/wxwidgets/wxWidgets-3.0.3.1/samples/widgets, if I add OSXIsGUIApplication returning false it no longer possible to change any texts:

    1807044532_Screenshot2020-05-26at14_11_48.thumb.png.145bafccedfcfb512b87bf2f02f44429.png

  10. 4 hours ago, wik said:

    It is normal not having window in editor?

    The only place we set m_Window is in CVideoMode::SetVideoMode:

    https://github.com/0ad/0ad/blob/3d2eca39310a27dbf7793e246392e97f14f5b01e/source/ps/VideoMode.cpp#L86

    m_Window = SDL_CreateWindow("0 A.D.", m_WindowedX, m_WindowedY, w, h, flags);

    But with "-editor" argument we skip this step in game setup:

    https://github.com/0ad/0ad/blob/3d2eca39310a27dbf7793e246392e97f14f5b01e/source/ps/GameSetup/GameSetup.cpp#L1009

    void InitGraphics(const CmdLineArgs& args, int flags, const std::vector<CStr>& installedMods)
    {
    	const bool setup_vmode = (flags & INIT_HAVE_VMODE) == 0;
    
    	if(setup_vmode)
    	{
    		InitSDL();
    
    		if (!g_VideoMode.InitSDL())
    			throw PSERROR_System_VmodeFailed(); // abort startup
    	}

    Because of the flag argument from GraphicsSetupHandlers

    https://github.com/0ad/0ad/blob/3d2eca39310a27dbf7793e246392e97f14f5b01e/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp#L41

    const int g_InitFlags = INIT_HAVE_VMODE|INIT_NO_GUI;

    Which we then pass to InitGraphics here:

    https://github.com/0ad/0ad/blob/3d2eca39310a27dbf7793e246392e97f14f5b01e/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp#L89

    InitGraphics(g_AtlasGameLoop->args, g_InitFlags, {});

    So, I suppose it is ok/intentional not having m_Window (g_VideoMode.GetWindow()) with "-editor" argument

    https://github.com/0ad/0ad/blob/3d2eca39310a27dbf7793e246392e97f14f5b01e/source/ps/GameSetup/GameSetup.h#L43 

    enum InitFlags
    {
    	// avoid setting a video mode / initializing OpenGL; assume that has
    	// already been done and everything is ready for rendering.
    	// needed by map editor because it creates its own window.
    	INIT_HAVE_VMODE = 1,


    Perhaps we need a different way to report sdl_video_backend in atlas editor, i.e. without window? :)

  11. SDL2-2.0.5 (current trunk) doesn't show assertion alert, but sdl_video_backend is still unknown with -editor

    ./binaries/system/pyrogenesis
    cat '/Users/wik/Library/Application Support/0ad/logs/userreport_hwdetect.txt' | grep 'sdl_video_backend'
      "sdl_video_backend": "Cocoa",
    
    ./binaries/system/pyrogenesis -editor
    cat '/Users/wik/Library/Application Support/0ad/logs/userreport_hwdetect.txt' | grep 'sdl_video_backend'
      "sdl_video_backend": "unknown",

    and there are more problems with SDL2-2.0.5, for example, it is impossible to enter / change any text fields in game, for example: to log into Lobby or change Player Name for Multiplayer

  12. I should mention that assertion gives you option to ignore problem and still open editor, but it can't detect sdl_video_backend without window

    ./binaries/system/pyrogenesis
    cat '/Users/wik/Library/Application Support/0ad/logs/userreport_hwdetect.txt' | grep 'sdl_video_backend'
      "sdl_video_backend": "Cocoa",
    
    ./binaries/system/pyrogenesis -editor
    cat '/Users/wik/Library/Application Support/0ad/logs/userreport_hwdetect.txt' | grep 'sdl_video_backend'
      "sdl_video_backend": "unknown",


     

  13. On 5/3/2020 at 10:10 PM, Langbart said:

    Problem: The game window looks like in the picture below. Everything is clickable but you have to operate through the black by trial&error.

    I noticed that switching to another window / screen and then switching back to the game window restores the view.

    But there is other problem with old SDL, it is impossible to enter any text, for example: to log into Lobby or change Player Name for Multiplayer

  14. @wraitii I had another look into "assertion failure" from SDL you mentioned in D2752

    Assertion failure at SDL_GetWindowWMInfo_REAL (/Users/Shared/github_repos/0ad/libraries/osx/sdl2/SDL2-2.0.12/src/video/SDL_video.c:3760), triggered 1 time:
      'window && window->magic == &_this->window_magic'

    and it looks like the reason for this is because we pass NULL as window and SDL 2.0.12 now throws an assertion for the case

    SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info)
    {
        CHECK_WINDOW_MAGIC(window, SDL_FALSE); // Line 3760, see SDL_Assert in CHECK_WINDOW_MAGIC definition below
    
        if (!info) {
            SDL_InvalidParamError("info");
            return SDL_FALSE;
        }
        info->subsystem = SDL_SYSWM_UNKNOWN;
    
        if (!_this->GetWindowWMInfo) {
            SDL_Unsupported();
            return SDL_FALSE;
        }
        return (_this->GetWindowWMInfo(_this, window, info));
    }
    
    #define CHECK_WINDOW_MAGIC(window, retval) \
        if (!_this) { \
            SDL_UninitializedVideo(); \
            return retval; \
        } \
        SDL_assert(window && window->magic == &_this->window_magic); \
        if (!window || window->magic != &_this->window_magic) { \
            SDL_SetError("Invalid window"); \
            return retval; \
        }

    The NULL comes from g_VideoMode.GetWindow() here:

    https://github.com/0ad/0ad/blob/3d2eca39310a27dbf7793e246392e97f14f5b01e/source/ps/GameSetup/HWDetect.cpp#L386

    const char* backend = GetSDLSubsystem(g_VideoMode.GetWindow());
    scriptInterface.SetProperty(settings, "sdl_video_backend", backend ? backend : "unknown");

    I also noticed that it is only NULL with "-editor" argument: "./binaries/system/pyrogenesis -editor" and it NOT in game. In game there is pointer to the window.
    It is normal not having window in editor?

  15. 7 hours ago, wraitii said:

    I failed to read your post and found a different solution in https://code.wildfiregames.com/D2752, but I suppose people will prefer your fixes for being less disruptive. I'll make a diff with your changes too. Thanks for reporting and debugging this.

    I report text input as working "correctly" if launched from in-game (as in, it's broken as it is on 10.14 with the double character thing).

    Edit: mh, pathching wxwidgets though.

    Thanks, I'll take a look into D2752.
    Pathching wxwidgets was helpful to discover any further problems, but probably not the best choice for long term solution unless there are no alternatives. :)

    I've pushed my changes to github with some notes/instructions, just in case, https://github.com/yevgenko/0ad/pull/1

     

    • Like 1
  16. trunk@23664 + https://code.wildfiregames.com/D2716 (just so I can build on Catalina)

    Build is ok, game is ok, but atlas editor returns the following:

    [1]    7736 illegal hardware instruction  binaries/system/pyrogenesis --editor

    With debugger:

    lldb binaries/system/pyrogenesis
    run -editor
    Process 10242 stopped
    * thread #2, stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
        frame #0: 0x00007fff31b7465c AppKit`-[NSOpenGLContext setView:] + 229
    AppKit`-[NSOpenGLContext setView:]:
    ->  0x7fff31b7465c <+229>: ud2    
        0x7fff31b7465e <+231>: movq   %rax, %r14
        0x7fff31b74661 <+234>: jmp    0x7fff31b74676            ; <+255>
        0x7fff31b74663 <+236>: movq   %rax, %rdi
    Target 0: (pyrogenesis) stopped.

    Backtrace:

    (lldb) bt
    * thread #2, stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
      * frame #0: 0x00007fff31b7465c AppKit`-[NSOpenGLContext setView:] + 229
        frame #1: 0x00000001078e3922 libAtlasUI.dylib`wxGLContext::SetCurrent(this=0x0000000110c51e08, win=0x0000000110c51af0) const at glcanvas.mm:335:5
        frame #2: 0x000000010039c224 pyrogenesis`RunEngine(args=<unavailable>) at GameLoop.cpp:174:6 [opt]
        frame #3: 0x000000010039c97a pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(void*) [inlined] decltype(std::__1::forward<void (*)(CmdLineArgs const&)>(fp)(std::__1::forward<std::__1::reference_wrapper<CmdLineArgs const> >(fp0))) std::__1::__invoke<void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> >(void (*&&)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const>&&) at type_traits:4425:1 [opt]
        frame #4: 0x000000010039c976 pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(void*) [inlined] void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const>, 2ul>(__t=<unavailable>)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> >&, std::__1::__tuple_indices<2ul>) at thread:341 [opt]
        frame #5: 0x000000010039c972 pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(__vp=0x000000010404f3b0) at thread:351 [opt]
        frame #6: 0x00007fff6e69f109 libsystem_pthread.dylib`_pthread_start + 148
        frame #7: 0x00007fff6e69ab8b libsystem_pthread.dylib`thread_start + 15

    libraries/osx/wxwidgets/wxWidgets-3.0.3.1/src/osx/cocoa/glcanvas.mm:335

    bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
    {
        if ( !m_glContext )
            return false;  
    
        [m_glContext setView: win.GetHandle() ]; // LINE 335
        [m_glContext update];
    
        [m_glContext makeCurrentContext];
        
        return true;
    }

    Similar issue in other projects:

    https://github.com/google/filament/pull/1959/files

    https://github.com/stepmania/stepmania/pull/1933/commits/81a041e3dd7a8a06ef85db7897572b816bbaba2a

    When I change wxGLContext::SetCurrent (glcanvas.mm around line 335) to the following:

    bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
    {
        if ( !m_glContext )
            return false;  
    
        dispatch_async(dispatch_get_main_queue(), ^{
            [m_glContext setView: win.GetHandle() ];
            [m_glContext update];
        });
    
        [m_glContext makeCurrentContext];
        
        return true;
    }

    NOTE: I have to use "_async", because the "_sync" one (used in other projects) creates deadlock here (not 100% sure why).

    And re-build affected parts of the project:

    pushd libraries/osx/wxwidgets/wxWidgets-3.0.3.1/build-release
    make -j8 && make install
    popd
    pushd build/workspaces/gcc
    make -C . -f AtlasUI.make verbose=true clean
    make -j8
    popd

    The next problem appears:

    Assertion failure at SDL_GetWindowWMInfo_REAL (/Users/wik/code/0ad/0ad/libraries/osx/sdl2/SDL2-2.0.12/src/video/SDL_video.c:3760), triggered 1 time:
      'window && window->magic == &_this->window_magic'
    2020-05-19 02:07:02.937 pyrogenesis[35178:7417651] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
    *** First throw call stack:
    (
    	0   CoreFoundation                      0x00007fff345ced07 __exceptionPreprocess + 250
    	1   libobjc.A.dylib                     0x00007fff6d2f35bf objc_exception_throw + 48
    	2   CoreFoundation                      0x00007fff345f750c -[NSException raise] + 9
    	3   AppKit                              0x00007fff317fe24c -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 310
    	4   AppKit                              0x00007fff317e5cb2 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1416
    	5   AppKit                              0x00007fff319c6a15 -[NSPanel _initContent:styleMask:backing:defer:contentView:] + 50
    	6   AppKit                              0x00007fff317e5723 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
    	7   AppKit                              0x00007fff319c69ca -[NSPanel initWithContentRect:styleMask:backing:defer:] + 64
    	8   AppKit                              0x00007fff317e3709 -[NSWindowTemplate nibInstantiate] + 393
    	9   AppKit                              0x00007fff317adaa6 -[NSIBObjectData instantiateObject:] + 253
    	10  AppKit                              0x00007fff317ad160 -[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 534
    	11  AppKit                              0x00007fff317a1331 loadNib + 401
    	12  AppKit                              0x00007fff317a08f2 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:options:withZone:ownerBundle:] + 693
    	13  AppKit                              0x00007fff317a0548 -[NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] + 201
    	14  AppKit                              0x00007fff31b691c4 -[NSAlert init] + 101
    	15  pyrogenesis                         0x000000010ff306a8 Cocoa_ShowMessageBox + 72
    	16  pyrogenesis                         0x000000010fe583f7 SDL_ShowMessageBox_REAL + 343
    	17  pyrogenesis                         0x000000010fd3ab81 SDL_PromptAssertion + 753
    	18  pyrogenesis                         0x000000010fd3a625 SDL_ReportAssertion_REAL + 325
    	19  pyrogenesis                         0x000000010fe57fe8 SDL_GetWindowWMInfo_REAL + 152
    	20  pyrogenesis                         0x000000010fd560b1 SDL_GetWindowWMInfo + 33
    	21  pyrogenesis                         0x000000010fcdcafa _Z15GetSDLSubsystemP10SDL_Window + 42
    	22  pyrogenesis                         0x000000010fa91fbe _Z20RunHardwareDetectionv + 2190
    	23  pyrogenesis                         0x000000010fa83a99 _Z12InitGraphicsRK11CmdLineArgsiRKNSt3__16vectorI5CStr8NS2_9allocatorIS4_EEEE + 329
    	24  pyrogenesis                         0x000000010fc38f25 _ZN12AtlasMessage13fInitGraphicsEPNS_13mInitGraphicsE + 69
    	25  pyrogenesis                         0x000000010fc250a4 _ZL9RunEngineRK11CmdLineArgs + 948
    	26  pyrogenesis                         0x000000010fc257fa _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEPFvRK11CmdLineArgsENS_17reference_wrapperIS8_EEEEEEEPvSF_ + 58
    	27  libsystem_pthread.dylib             0x00007fff6e69f109 _pthread_start + 148
    	28  libsystem_pthread.dylib             0x00007fff6e69ab8b thread_start + 15
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
    [1]    35178 abort      binaries/system/pyrogenesis --editor

    Backtrace from debugger:

    (lldb) bt
    * thread #2, stop reason = signal SIGABRT
      * frame #0: 0x00007fff6e5e233a libsystem_kernel.dylib`__pthread_kill + 10
        frame #1: 0x00007fff6e69ee60 libsystem_pthread.dylib`pthread_kill + 430
        frame #2: 0x00007fff6e569808 libsystem_c.dylib`abort + 120
        frame #3: 0x00007fff6b7c9458 libc++abi.dylib`abort_message + 231
        frame #4: 0x00007fff6b7ba8bf libc++abi.dylib`demangling_terminate_handler() + 262
        frame #5: 0x00007fff6d2f55a9 libobjc.A.dylib`_objc_terminate() + 96
        frame #6: 0x00007fff6b7c8887 libc++abi.dylib`std::__terminate(void (*)()) + 8
        frame #7: 0x00007fff6b7cb1a2 libc++abi.dylib`__cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 27
        frame #8: 0x00007fff6b7cb169 libc++abi.dylib`__cxa_throw + 113
        frame #9: 0x00007fff6d2f36ed libobjc.A.dylib`objc_exception_throw + 350
        frame #10: 0x00007fff345f750c CoreFoundation`-[NSException raise] + 9
        frame #11: 0x00007fff317fe24c AppKit`-[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 310
        frame #12: 0x00007fff317e5cb2 AppKit`-[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1416
        frame #13: 0x00007fff319c6a15 AppKit`-[NSPanel _initContent:styleMask:backing:defer:contentView:] + 50
        frame #14: 0x00007fff317e5723 AppKit`-[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
        frame #15: 0x00007fff319c69ca AppKit`-[NSPanel initWithContentRect:styleMask:backing:defer:] + 64
        frame #16: 0x00007fff317e3709 AppKit`-[NSWindowTemplate nibInstantiate] + 393
        frame #17: 0x00007fff317adaa6 AppKit`-[NSIBObjectData instantiateObject:] + 253
        frame #18: 0x00007fff317ad160 AppKit`-[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 534
        frame #19: 0x00007fff317a1331 AppKit`loadNib + 401
        frame #20: 0x00007fff317a08f2 AppKit`+[NSBundle(NSNibLoading) _loadNibFile:nameTable:options:withZone:ownerBundle:] + 693
        frame #21: 0x00007fff317a0548 AppKit`-[NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] + 201
        frame #22: 0x00007fff31b691c4 AppKit`-[NSAlert init] + 101
        frame #23: 0x00000001006a76a8 pyrogenesis`Cocoa_ShowMessageBox + 72
        frame #24: 0x00000001005cf3f7 pyrogenesis`SDL_ShowMessageBox_REAL + 343
        frame #25: 0x00000001004b1b81 pyrogenesis`SDL_PromptAssertion + 753
        frame #26: 0x00000001004b1625 pyrogenesis`SDL_ReportAssertion_REAL + 325
        frame #27: 0x00000001005cefe8 pyrogenesis`SDL_GetWindowWMInfo_REAL + 152
        frame #28: 0x00000001004cd0b1 pyrogenesis`SDL_GetWindowWMInfo + 33
        frame #29: 0x0000000100453afa pyrogenesis`GetSDLSubsystem(window=<unavailable>) at libsdl.cpp:37:7 [opt]
        frame #30: 0x0000000100208fbe pyrogenesis`RunHardwareDetection() [inlined] ReportSDL(scriptInterface=<unavailable>, settings=<unavailable>) at HWDetect.cpp:386:24 [opt]
        frame #31: 0x0000000100208efb pyrogenesis`RunHardwareDetection() at HWDetect.cpp:289 [opt]
        frame #32: 0x00000001001faa99 pyrogenesis`InitGraphics(args=0x000000010331b2d0, flags=3, installedMods=size=0) at GameSetup.cpp:1017:2 [opt]
        frame #33: 0x00000001003aff25 pyrogenesis`AtlasMessage::fInitGraphics(msg=<unavailable>) at GraphicsSetupHandlers.cpp:89:2 [opt]
        frame #34: 0x000000010039c0a4 pyrogenesis`RunEngine(args=<unavailable>) at GameLoop.cpp:174:6 [opt]
        frame #35: 0x000000010039c7fa pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(void*) [inlined] decltype(std::__1::forward<void (*)(CmdLineArgs const&)>(fp)(std::__1::forward<std::__1::reference_wrapper<CmdLineArgs const> >(fp0))) std::__1::__invoke<void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> >(void (*&&)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const>&&) at type_traits:4425:1 [opt]
        frame #36: 0x000000010039c7f6 pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(void*) [inlined] void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const>, 2ul>(__t=<unavailable>)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> >&, std::__1::__tuple_indices<2ul>) at thread:341 [opt]
        frame #37: 0x000000010039c7f2 pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(__vp=0x0000000104006050) at thread:351 [opt]
        frame #38: 0x00007fff6e69f109 libsystem_pthread.dylib`_pthread_start + 148
        frame #39: 0x00007fff6e69ab8b libsystem_pthread.dylib`thread_start + 15

    Changing the following lines https://github.com/0ad/0ad/blob/1bfe7b2905a88b60d9299dc1614eede2e6fab2f9/source/ps/GameSetup/HWDetect.cpp#L386-L387

    	const char* backend = GetSDLSubsystem(g_VideoMode.GetWindow());
    	scriptInterface.SetProperty(settings, "sdl_video_backend", backend ? backend : "unknown");

    To

    	// can't access window from current thread,
    	// g_VideoMode.GetWindow() => EXC_BAD_ACCESS
    	//const char* backend = GetSDLSubsystem(g_VideoMode.GetWindow());
    	scriptInterface.SetProperty(settings, "sdl_video_backend", "unknown");

    Allows to run editor again, there are some other issues though

    1678715973_Screenshot2020-05-19at02_20_59.thumb.png.5babecf853c719ec6a70c77118d3b22c.png

    It is impossible to enter any text into input fields, for some reason it captures all input on the terminal only

    Another problem is similar to one previously reported, but upgrading to SDL2-2.0.12 didn't help in this case:

     

×
×
  • Create New...