Page 158 of 234

Re: JGR's Patch Pack

Posted: 30 Dec 2020 05:50
by Snail
Hi,

I'm trying to compile OTTD with your patch pack on my MacBook Pro running OSX 10.12.6 . I downloaded your binaries from GitHub (0.39.2) and just upgraded my CMake to 3.19.2 .
In the first step (when I ran "cmake .. ") , I got the warning that LibLZMA wasn't found. I then tried to install it (by doing a SUDO PORT INSTALL liblzma), but I got the message that liblzma was obsolete: the same message said it was included in the "xz" library, which I therefore installed instead.

Once running the "make" on your source code, all the files seemed to compile correctly, but at the end, I got this message when it was doing the "linking:"

Code: Select all

[100%] Linking CXX executable openttd
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: ignoring file /usr/local/lib/liblzo2.a, file was built for archive which is not the architecture being linked (x86_64): /usr/local/lib/liblzo2.a
Undefined symbols for architecture x86_64:
  "___lzo_init_v2", referenced from:
      LoadFilter* CreateLoadFilter<LZOLoadFilter>(LoadFilter*) in saveload.cpp.o
      SaveFilter* CreateSaveFilter<LZOSaveFilter>(SaveFilter*, unsigned char) in saveload.cpp.o
  "_libiconv", referenced from:
      convert_tofrom_fs(void*, char const*) in unix.cpp.o
  "_libiconv_open", referenced from:
      OTTD2FS(char const*) in unix.cpp.o
      FS2OTTD(char const*) in unix.cpp.o
  "_lzo1x_1_compress", referenced from:
      LZOSaveFilter::Write(unsigned char*, unsigned long) in saveload.cpp.o
  "_lzo1x_decompress_safe", referenced from:
      LZOLoadFilter::Read(unsigned char*, unsigned long) in saveload.cpp.o
  "_lzo_adler32", referenced from:
      LZOLoadFilter::Read(unsigned char*, unsigned long) in saveload.cpp.o
      LZOSaveFilter::Write(unsigned char*, unsigned long) in saveload.cpp.o
  "_lzo_version_string", referenced from:
      CrashLog::LogLibraries(char*, char const*) const in crashlog.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [openttd] Error 1
make[1]: *** [CMakeFiles/openttd.dir/all] Error 2
make: *** [all] Error 2
Am I doing something wrong here, or am I missing anything critical? How would you suggest me to do in order to avoid this problem?

Thanks in advance!

Re: JGR's Patch Pack

Posted: 30 Dec 2020 10:54
by vincentkoevoets
Snail wrote: 30 Dec 2020 05:50 Hi,

I'm trying to compile OTTD with your patch pack on my MacBook Pro running OSX 10.12.6 . I downloaded your binaries from GitHub (0.39.2) and just upgraded my CMake to 3.19.2 .
In the first step (when I ran "cmake .. ") , I got the warning that LibLZMA wasn't found. I then tried to install it (by doing a SUDO PORT INSTALL liblzma), but I got the message that liblzma was obsolete: the same message said it was included in the "xz" library, which I therefore installed instead.

Once running the "make" on your source code, all the files seemed to compile correctly, but at the end, I got this message when it was doing the "linking:"

Code: Select all

[100%] Linking CXX executable openttd
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: ignoring file /usr/local/lib/liblzo2.a, file was built for archive which is not the architecture being linked (x86_64): /usr/local/lib/liblzo2.a
Undefined symbols for architecture x86_64:
  "___lzo_init_v2", referenced from:
      LoadFilter* CreateLoadFilter<LZOLoadFilter>(LoadFilter*) in saveload.cpp.o
      SaveFilter* CreateSaveFilter<LZOSaveFilter>(SaveFilter*, unsigned char) in saveload.cpp.o
  "_libiconv", referenced from:
      convert_tofrom_fs(void*, char const*) in unix.cpp.o
  "_libiconv_open", referenced from:
      OTTD2FS(char const*) in unix.cpp.o
      FS2OTTD(char const*) in unix.cpp.o
  "_lzo1x_1_compress", referenced from:
      LZOSaveFilter::Write(unsigned char*, unsigned long) in saveload.cpp.o
  "_lzo1x_decompress_safe", referenced from:
      LZOLoadFilter::Read(unsigned char*, unsigned long) in saveload.cpp.o
  "_lzo_adler32", referenced from:
      LZOLoadFilter::Read(unsigned char*, unsigned long) in saveload.cpp.o
      LZOSaveFilter::Write(unsigned char*, unsigned long) in saveload.cpp.o
  "_lzo_version_string", referenced from:
      CrashLog::LogLibraries(char*, char const*) const in crashlog.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [openttd] Error 1
make[1]: *** [CMakeFiles/openttd.dir/all] Error 2
make: *** [all] Error 2
Am I doing something wrong here, or am I missing anything critical? How would you suggest me to do in order to avoid this problem?

Thanks in advance!
I strongly suggested using Homebrew a few posts back, and I still do. Ever since I switched from MacPorts to Homebrew all my problems are gone.
In the meantime, here is the new 0.39.2 build for Mac OS.
openttd-jgrpp-0.39.2-macosx.dmg
(8.49 MiB) Downloaded 164 times

Re: JGR's Patch Pack

Posted: 30 Dec 2020 13:40
by Snail
vincentkoevoets wrote: 30 Dec 2020 10:54 I strongly suggested using Homebrew a few posts back, and I still do. Ever since I switched from MacPorts to Homebrew all my problems are gone.
In the meantime, here is the new 0.39.2 build for Mac OS.

openttd-jgrpp-0.39.2-macosx.dmg
Thanks! I think using Homebrew could help me install LibLZMA. How else would it help me solve the error I got when compiling?
Also, unfortunately the build you gave me crashes upon the start. This is the log file I got.

Re: JGR's Patch Pack

Posted: 30 Dec 2020 14:01
by Eddi
Snail wrote: 30 Dec 2020 05:50I got the warning that LibLZMA wasn't found.
that's mostly a misnomer, what openttd actually looks for is lzma2, which at some point was renamed to xz, but somehow the old name keeps sticking around.

your remaining link errors are about lzo and iconv

Re: JGR's Patch Pack

Posted: 30 Dec 2020 14:36
by Snail
Eddi wrote: 30 Dec 2020 14:01
Snail wrote: 30 Dec 2020 05:50I got the warning that LibLZMA wasn't found.
that's mostly a misnomer, what openttd actually looks for is lzma2, which at some point was renamed to xz, but somehow the old name keeps sticking around.

your remaining link errors are about lzo and iconv
Got it. So should I update those two and then retry compiling?

- EDIT - looks like I've got both already installed:

Code: Select all

  libiconv @1.13.1_0
  libiconv @1.14_0
  libiconv @1.14_0+universal (active)
 lzo @1.08_0 (active)
 
Are these the correct versions?

Re: JGR's Patch Pack

Posted: 31 Dec 2020 09:27
by Eddi
i can't speak for OSX, but conceptually, a library consists of two parts:
  1. a runtime, which the linker looks for
  2. headers which the compiler looks for
link errors like this happen, when the two parts do not match, for example it's looking in the wrong directory and finding the runtime of a different version than the headers, which could be an error in the cmake configuration. or the runtime is installed for the wrong architecture (32bit vs. 64bit)

Re: JGR's Patch Pack

Posted: 01 Jan 2021 00:52
by Argus
Problem persist. I recorded the same game I reported, and it's still not correct.

Re: JGR's Patch Pack

Posted: 01 Jan 2021 11:00
by Argus
The question is whether it's not because there was an early version of NRT in the Joker patchpack .... Some games are already loading properly...

Re: JGR's Patch Pack

Posted: 01 Jan 2021 22:02
by Snail
Alright, now I switched from MacPorts to Homebrew. After some tinkering, OTTD now does compile, but it crashes upon start.

Upon compiling, I got the following warnings:

Code: Select all

ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: object file (/usr/local/lib/liblzo2.a(lzo_init.o)) was built for newer OSX version (10.12) than being linked (10.9)
ld: warning: object file (/usr/local/lib/liblzo2.a(lzo1x_1.o)) was built for newer OSX version (10.12) than being linked (10.9)
ld: warning: object file (/usr/local/lib/liblzo2.a(lzo1x_d2.o)) was built for newer OSX version (10.12) than being linked (10.9)
ld: warning: object file (/usr/local/lib/liblzo2.a(lzo_util.o)) was built for newer OSX version (10.12) than being linked (10.9)
Again, I'm using Mac OS 10.12 and CMake 3.19.2 .
The crash report I got in Terminal is the following:

Code: Select all

Crash encountered, generating crash log...
*** OpenTTD Crash Report ***

Crash at: Fri Jan  1 21:54:22 2021
In game date: 0-01-00 (0, 0) (DL: 0)

Crash reason:
 Signal:  Segmentation fault: 11 (11)
          si_code: 1
          Fault address: 0x3
          Instruction address: 0x10486f2d2
 Message: <none>

OpenTTD version:
 Version:    jgrpp-0.39.2 (0)
 NewGRF ver: 1b006d64
 Bits:       64
 Endian:     little
 Dedicated:  no
 Build date: Jan  1 2021 15:53:41
 Defines:    WITH_UCONTEXT WITH_BITMATH_BUILTINS WITH_OVERFLOW_BUILTINS WITH_DL WITH_DEMANGLE WITH_SIGACTION WITH_DBG_GDB WITH_UCONTEXT NDEBUG TTD_ENDIAN=TTD_LITTLE_ENDIAN UNIX WITH_PNG WITH_ZLIB WITH_LZO WITH_FREETYPE WITH_ICONV WITH_COCOA ENABLE_COCOA_QUARTZ WITH_PERSONAL_DIR WITH_SHARED_DIR WITH_SSE WITH_ASSERT _SQ64


Stacktrace:
 [00] openttd              0x00000001048c57d4 (CrashLog::FillCrashLog(char*, char const*) const + 692)
 [01] openttd              0x00000001047891d5 (CrashLogOSX::MakeCrashLog() + 69)
 [02] openttd              0x00000001047890f0 (HandleCrash(int, __siginfo*, void*) + 208)
 [03] libsystem_platform.dylib 0x00007fff944d9b3a (_sigtramp + 26)

LLDB info:
(lldb) process attach --pid 84328
Process 84328 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x0000000109f6b246 libsystem_kernel.dylib`read + 10
libsystem_kernel.dylib`read:
->  0x109f6b246 <+10>: jae    0x109f6b250               ; <+20>
    0x109f6b248 <+12>: movq   %rax, %rdi
    0x109f6b24b <+15>: jmp    0x109f62cd4               ; cerror
    0x109f6b250 <+20>: retq   
Target 0: (openttd) stopped.

Executable module set to "/Roba/openttd_jgr_202012/build/openttd".
Architecture set to: x86_64h-apple-macosx.
(lldb) bt 100
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x0000000109f6b246 libsystem_kernel.dylib`read + 10
    frame #1: 0x0000000104789c19 openttd`CrashLogOSX::LogLldbInfo(char*, char const*) const + 713
    frame #2: 0x0000000104789785 openttd`CrashLogOSX::LogRegisters(char*, char const*) const + 21
    frame #3: 0x00000001048c57e3 openttd`CrashLog::FillCrashLog(char*, char const*) const + 707
    frame #4: 0x00000001047891d5 openttd`CrashLogOSX::MakeCrashLog() + 69
    frame #5: 0x00000001047890f0 openttd`HandleCrash(int, __siginfo*, void*) + 208
    frame #6: 0x00007fff944d9b3a libsystem_platform.dylib`_sigtramp + 26
    frame #7: 0x000000010486f2d3 openttd`WindowQuartzSubdriver::SetPortAlphaOpaque() + 51
    frame #8: 0x000000010486a6e4 openttd`-[OTTD_CocoaWindow display] + 36
    frame #9: 0x0000000106f88428 AppKit`-[NSWindow _setColorSpace:sendNotification:displayIfChanged:] + 431
    frame #10: 0x000000010486e709 openttd`WindowQuartzSubdriver::SetVideoMode(int, int, int) + 1145
    frame #11: 0x000000010486f566 openttd`QZ_CreateWindowQuartzSubdriver(int, int, int) + 262
    frame #12: 0x0000000104869956 openttd`VideoDriver_Cocoa::Start(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) + 182
    frame #13: 0x00000001048e044f openttd`DriverFactoryBase::SelectDriverImpl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Driver::Type) + 767
    frame #14: 0x00000001048e00f1 openttd`DriverFactoryBase::SelectDriver(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Driver::Type) + 17
    frame #15: 0x0000000104a0baa2 openttd`openttd_main(int, char**) + 3666
    frame #16: 0x000000010478d7c7 openttd`main + 151
    frame #17: 0x0000000109f14235 libdyld.dylib`start + 1
(lldb) disassemble -b -F intel -c 1 -s 0x10486f2d2
openttd`WindowQuartzSubdriver::SetPortAlphaOpaque:
    0x10486f2d2 <+50>: c6 44 88 03 ff  mov    byte ptr [rax + 4*rcx + 0x3], -0x1

Registers:
 rax:                0 rbx:   0x7f8e79e1b430 rcx:                0 rdx:                0
 rsi:                0 rdi:   0x7f8e7b038200 rbp:   0x7fff5b56c1e0 rsp:   0x7fff5b56c1e0
 r8:             0x4d0 r9:             0x325 r10:                0 r11:                0
 r12:   0x7fff93982001 r13:              0x1 r14:            0x100 r15:   0x7f8e79c11ac0
 rip:      0x10486f2d2 rflags:  0x10246

Operating system:
 Name:     Mac OS X
 Release:  10.12.6
 Machine:  Intel x86-64h Haswell
 Min Ver:  1090
 Max Ver:  101204
 Compiler: clang 9.0.0 (clang-900.0.39.2) "4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)"

Configuration:
 Blitter:      32bpp-anim
 Graphics set: original_windows (0)
 Language:     /Roba/openttd_jgr_202012/build/lang/italian.lng
 Music driver: none
 Music set:    none (4294967295)
 Network:      no
 Sound driver: none
 Sound set:    none (4294967295)
 Video driver: cocoa
 Pathfinder:   - - -

Fonts:
 Small:  sprite
 Medium: sprite
 Large:  Dauphin
 Mono:   sprite

Map size: 0x0 (0 x 0), NO MAP ALLOCATED

AI Configuration (local: 0) (current: 0):

Libraries:
 FreeType:   2.10.4
 LZO:        2.10
 PNG:        1.6.37
 Zlib:       1.2.8

---- gamelog start ----
---- gamelog end ----

Recent news messages (0 of 0):

Command Log:
 Showing most recent 0 of 0 commands

*** End of OpenTTD Crash Report ***

Crash log generated.

Writing crash log to disk...
Writing crash savegame...
Writing crash screenshot...
Abort
logout
Any ideas?

Re: JGR's Patch Pack

Posted: 01 Jan 2021 22:30
by JGR
Snail wrote: 01 Jan 2021 22:02 Alright, now I switched from MacPorts to Homebrew. After some tinkering, OTTD now does compile, but it crashes upon start.

Upon compiling, I got the following warnings:

Code: Select all

ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: object file (/usr/local/lib/liblzo2.a(lzo_init.o)) was built for newer OSX version (10.12) than being linked (10.9)
ld: warning: object file (/usr/local/lib/liblzo2.a(lzo1x_1.o)) was built for newer OSX version (10.12) than being linked (10.9)
ld: warning: object file (/usr/local/lib/liblzo2.a(lzo1x_d2.o)) was built for newer OSX version (10.12) than being linked (10.9)
ld: warning: object file (/usr/local/lib/liblzo2.a(lzo_util.o)) was built for newer OSX version (10.12) than being linked (10.9)
Again, I'm using Mac OS 10.12 and CMake 3.19.2 .
The crash report I got in Terminal is the following:

Code: Select all

Crash encountered, generating crash log...
*** OpenTTD Crash Report ***

Crash at: Fri Jan  1 21:54:22 2021
In game date: 0-01-00 (0, 0) (DL: 0)

Crash reason:
 Signal:  Segmentation fault: 11 (11)
          si_code: 1
          Fault address: 0x3
          Instruction address: 0x10486f2d2
 Message: <none>

OpenTTD version:
 Version:    jgrpp-0.39.2 (0)
 NewGRF ver: 1b006d64
 Bits:       64
 Endian:     little
 Dedicated:  no
 Build date: Jan  1 2021 15:53:41
 Defines:    WITH_UCONTEXT WITH_BITMATH_BUILTINS WITH_OVERFLOW_BUILTINS WITH_DL WITH_DEMANGLE WITH_SIGACTION WITH_DBG_GDB WITH_UCONTEXT NDEBUG TTD_ENDIAN=TTD_LITTLE_ENDIAN UNIX WITH_PNG WITH_ZLIB WITH_LZO WITH_FREETYPE WITH_ICONV WITH_COCOA ENABLE_COCOA_QUARTZ WITH_PERSONAL_DIR WITH_SHARED_DIR WITH_SSE WITH_ASSERT _SQ64


Stacktrace:
 [00] openttd              0x00000001048c57d4 (CrashLog::FillCrashLog(char*, char const*) const + 692)
 [01] openttd              0x00000001047891d5 (CrashLogOSX::MakeCrashLog() + 69)
 [02] openttd              0x00000001047890f0 (HandleCrash(int, __siginfo*, void*) + 208)
 [03] libsystem_platform.dylib 0x00007fff944d9b3a (_sigtramp + 26)

LLDB info:
(lldb) process attach --pid 84328
Process 84328 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x0000000109f6b246 libsystem_kernel.dylib`read + 10
libsystem_kernel.dylib`read:
->  0x109f6b246 <+10>: jae    0x109f6b250               ; <+20>
    0x109f6b248 <+12>: movq   %rax, %rdi
    0x109f6b24b <+15>: jmp    0x109f62cd4               ; cerror
    0x109f6b250 <+20>: retq   
Target 0: (openttd) stopped.

Executable module set to "/Roba/openttd_jgr_202012/build/openttd".
Architecture set to: x86_64h-apple-macosx.
(lldb) bt 100
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x0000000109f6b246 libsystem_kernel.dylib`read + 10
    frame #1: 0x0000000104789c19 openttd`CrashLogOSX::LogLldbInfo(char*, char const*) const + 713
    frame #2: 0x0000000104789785 openttd`CrashLogOSX::LogRegisters(char*, char const*) const + 21
    frame #3: 0x00000001048c57e3 openttd`CrashLog::FillCrashLog(char*, char const*) const + 707
    frame #4: 0x00000001047891d5 openttd`CrashLogOSX::MakeCrashLog() + 69
    frame #5: 0x00000001047890f0 openttd`HandleCrash(int, __siginfo*, void*) + 208
    frame #6: 0x00007fff944d9b3a libsystem_platform.dylib`_sigtramp + 26
    frame #7: 0x000000010486f2d3 openttd`WindowQuartzSubdriver::SetPortAlphaOpaque() + 51
    frame #8: 0x000000010486a6e4 openttd`-[OTTD_CocoaWindow display] + 36
    frame #9: 0x0000000106f88428 AppKit`-[NSWindow _setColorSpace:sendNotification:displayIfChanged:] + 431
    frame #10: 0x000000010486e709 openttd`WindowQuartzSubdriver::SetVideoMode(int, int, int) + 1145
    frame #11: 0x000000010486f566 openttd`QZ_CreateWindowQuartzSubdriver(int, int, int) + 262
    frame #12: 0x0000000104869956 openttd`VideoDriver_Cocoa::Start(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) + 182
    frame #13: 0x00000001048e044f openttd`DriverFactoryBase::SelectDriverImpl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Driver::Type) + 767
    frame #14: 0x00000001048e00f1 openttd`DriverFactoryBase::SelectDriver(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Driver::Type) + 17
    frame #15: 0x0000000104a0baa2 openttd`openttd_main(int, char**) + 3666
    frame #16: 0x000000010478d7c7 openttd`main + 151
    frame #17: 0x0000000109f14235 libdyld.dylib`start + 1
(lldb) disassemble -b -F intel -c 1 -s 0x10486f2d2
openttd`WindowQuartzSubdriver::SetPortAlphaOpaque:
    0x10486f2d2 <+50>: c6 44 88 03 ff  mov    byte ptr [rax + 4*rcx + 0x3], -0x1

Registers:
 rax:                0 rbx:   0x7f8e79e1b430 rcx:                0 rdx:                0
 rsi:                0 rdi:   0x7f8e7b038200 rbp:   0x7fff5b56c1e0 rsp:   0x7fff5b56c1e0
 r8:             0x4d0 r9:             0x325 r10:                0 r11:                0
 r12:   0x7fff93982001 r13:              0x1 r14:            0x100 r15:   0x7f8e79c11ac0
 rip:      0x10486f2d2 rflags:  0x10246

Operating system:
 Name:     Mac OS X
 Release:  10.12.6
 Machine:  Intel x86-64h Haswell
 Min Ver:  1090
 Max Ver:  101204
 Compiler: clang 9.0.0 (clang-900.0.39.2) "4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)"

Configuration:
 Blitter:      32bpp-anim
 Graphics set: original_windows (0)
 Language:     /Roba/openttd_jgr_202012/build/lang/italian.lng
 Music driver: none
 Music set:    none (4294967295)
 Network:      no
 Sound driver: none
 Sound set:    none (4294967295)
 Video driver: cocoa
 Pathfinder:   - - -

Fonts:
 Small:  sprite
 Medium: sprite
 Large:  Dauphin
 Mono:   sprite

Map size: 0x0 (0 x 0), NO MAP ALLOCATED

AI Configuration (local: 0) (current: 0):

Libraries:
 FreeType:   2.10.4
 LZO:        2.10
 PNG:        1.6.37
 Zlib:       1.2.8

---- gamelog start ----
---- gamelog end ----

Recent news messages (0 of 0):

Command Log:
 Showing most recent 0 of 0 commands

*** End of OpenTTD Crash Report ***

Crash log generated.

Writing crash log to disk...
Writing crash savegame...
Writing crash screenshot...
Abort
logout
Any ideas?
The log suggests that WindowQuartzSubdriver::window_buffer and therefore pixels is nullptr in wnd_quartz.mm, when executing

Code: Select all

pixels[y * pitch + x] |= 0xFF000000;
(fault address and register values compared with fault instruction).

In WindowQuartzSubdriver::SetVideoMode it appears probable that NSWindow _setColorSpace:sendNotification:displayIfChanged is called synchronously from

Code: Select all

[this->window setColorSpace:[NSColorSpace sRGBColorSpace]];
(from the stack trace).

This is before the call to WindowQuartzSubdriver::WindowResized which is where WindowQuartzSubdriver::window_buffer is allocated, so I don't see how this code is supposed to work.

This was introduced by this commit, so I'd suggest that you git revert that commit and try it again.
If that resolves the issue I can revert it at my end and/or the IRC folks can take a look at it.

Re: JGR's Patch Pack

Posted: 01 Jan 2021 22:39
by Snail
Thanks. That commit seems to date back to March 30th, 2020, so should I try with the latest version before that (it seems to be v0.34-rc1)?

Re: JGR's Patch Pack

Posted: 01 Jan 2021 22:46
by Auge
Hello
Snail wrote: 01 Jan 2021 22:39 Thanks. That commit seems to date back to March 30th, 2020, so should I try with the latest version before that (it seems to be v0.34-rc1)?
As far as I remember, the version 0.34.1 was to be compiled the old way with ./configure and make and not with cmake .. and make. I've no clue if that influences your problem. From my side it's only a reminder about a possibly relevant change.

Tschö, Auge

Re: JGR's Patch Pack

Posted: 01 Jan 2021 22:48
by JGR
Snail wrote: 01 Jan 2021 22:39 Thanks. That commit seems to date back to March 30th, 2020, so should I try with the latest version before that (it seems to be v0.34-rc1)?
Just running

Code: Select all

git revert -n bd3a5876
should be enough

Re: JGR's Patch Pack

Posted: 01 Jan 2021 22:53
by Snail
Hmm... I'm not very familiar with git, so I just downloaded the ZIP of the version I referred to and compiled it the old way. That OpenTTD runs fine.

Re: JGR's Patch Pack

Posted: 02 Jan 2021 15:25
by Argus
Does setting the industry economy to "frozen" only affect the vanilla industry? It doesn't do anything with Auzind, for example.

Re: JGR's Patch Pack

Posted: 02 Jan 2021 19:05
by slate
Could someone compile me 0.39.2 for android? Running a server for me and my buddies and would be great to play on my tablet too. Compiled it already for osx and linux, but got no tools / knowledge to compile it for Android.

Re: JGR's Patch Pack

Posted: 02 Jan 2021 19:06
by Snail
JGR wrote: 01 Jan 2021 22:48
Snail wrote: 01 Jan 2021 22:39 Thanks. That commit seems to date back to March 30th, 2020, so should I try with the latest version before that (it seems to be v0.34-rc1)?
Just running

Code: Select all

git revert -n bd3a5876
should be enough
I think that commit is a bit too old. When I run the git command as you instructed, I get the following:

Code: Select all

error: could not revert bd3a5876b0... Fix #7644: [Cocoa] Manually set colorspace to sRGB
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
Should I try to revert to it manually? If so, how?

Re: JGR's Patch Pack

Posted: 02 Jan 2021 20:15
by JGR
Snail wrote: 02 Jan 2021 19:06
JGR wrote: 01 Jan 2021 22:48
Snail wrote: 01 Jan 2021 22:39 Thanks. That commit seems to date back to March 30th, 2020, so should I try with the latest version before that (it seems to be v0.34-rc1)?
Just running

Code: Select all

git revert -n bd3a5876
should be enough
I think that commit is a bit too old. When I run the git command as you instructed, I get the following:

Code: Select all

error: could not revert bd3a5876b0... Fix #7644: [Cocoa] Manually set colorspace to sRGB
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
Should I try to revert to it manually? If so, how?
Hmm, I think I'd have to spend some time resolving it myself, it is not as straightforward as I had presumed.

On the other hand, michi_cc's PR might remove the problem instead https://github.com/OpenTTD/OpenTTD/pull/8479, that will also require some resolving from me to integrate.

In the meantime, I've added a one-liner to my branch which should hopefully allow you to make progress.

Re: JGR's Patch Pack

Posted: 02 Jan 2021 21:44
by JGR
Argus wrote: 02 Jan 2021 15:25 Does setting the industry economy to "frozen" only affect the vanilla industry? It doesn't do anything with Auzind, for example.
I can't say that I've tried it yet. This is an upstream feature.
However, it appears that it wouldn't affect industry sets which use production or production change callbacks, which is presumably most of them.
slate wrote: 02 Jan 2021 19:05 Could someone compile me 0.39.2 for android? Running a server for me and my buddies and would be great to play on my tablet too. Compiled it already for osx and linux, but got no tools / knowledge to compile it for Android.
You'll probably need to ask pelya.
I'm not personally involved in the Android port. I gather that it involves significant manual work for each new release, and is not simply a case of compiling the existing code for a different platform.

Re: JGR's Patch Pack

Posted: 02 Jan 2021 21:45
by Timberwolf
I've found a tiny bug in the optimised sprite rendering... mainly because I've been looking at similar things in regular OpenTTD and encountered the same problem myself.

The current code assumes that all sprites for a given direction have the same bounding box. Which is usually valid, but some sets get particularly abusive, for example Timberwolf's Trains which has a tendency to swap between 1x1 "invisible" sprites and larger vehicle sections depending on how it feels like rendering long vehicles at that point. This interacts unfortunately with the optimised renderer, which takes the bounding box for a sprite the first time a vehicle enters a new direction. On Timberwolf's Trains, this is still using one of the intermediate turn sprites and thus the front and rear sections of the vehicle have their 1x1 "invisible" sprites in play. This means JGRPP will then cache this size for determining whether a vehicle is in a viewport, and you get a slightly jumpy effect on straight tracks once Trains has swapped to its alternate scheme of splitting the vehicle into three sprites.

When this strikes, you get this happening at the very edge of the viewport:

Image

I noted you're not using this optimisation for ships/aircraft, where this kind of internal mucking about with sprite geometry is more common. At any rate, it's a tiny thing you have to be looking hard to notice, and the correct response may indeed be "Closed: Timberwolf is a bad person and should not do the unnatural things his train set attempts to inflict upon the world."

(If I figure out a fix which still keeps the massive performance improvement from sprite direction caching I'll let you know. And if it's a massive, massive pain I might look at making my train set use more consistent bounding boxes as I don't think anything else is affected with the possible exception of some of the old CETS test releases. Edit: https://github.com/OpenTTD/OpenTTD/pull/8485 is my variant, which reduces the number of cases in which this happens by considering vehicles to be "viewport candidates" and reverting to checking every tick. There may be a more efficient and reliable approach than this still out there.)