Vanilla-Conquer icon indicating copy to clipboard operation
Vanilla-Conquer copied to clipboard

Could not read temperat.pal

Open giulianobelinassi opened this issue 4 years ago • 4 comments

I just cloned the master branch and compiled it. Then I placed the vanillatd binary into the CnCNet directory and launched it, which results in a Segmentation Fault with the following stacktrace

(gdb) backtrace
#0  0x00007ffff79fc679 in clearerr (fp=0x0) at clearerr.c:25
#1  0x0000555555680f67 in RawFileClass::Raw_Seek (this=0x7fffffffd790, pos=0, 
    dir=1) at /home/giulianob/bagunca/Vanilla-Conquer/common/rawfile.cpp:886
#2  0x0000555555680a8e in RawFileClass::Seek (this=0x7fffffffd790, pos=0, 
    dir=1) at /home/giulianob/bagunca/Vanilla-Conquer/common/rawfile.cpp:638
#3  0x0000555555669ee0 in BufferIOFileClass::Read (this=0x7fffffffd790, 
    buffer=0x555556271130, size=768)
    at /home/giulianob/bagunca/Vanilla-Conquer/common/bfiofile.cpp:715
#4  0x000055555566af1a in CCFileClass::Read (this=0x7fffffffd790, 
    buffer=0x555556271130, size=768)
    at /home/giulianob/bagunca/Vanilla-Conquer/common/ccfile.cpp:202
#5  0x00005555555ebf53 in Init_Game ()
    at /home/giulianob/bagunca/Vanilla-Conquer/tiberiandawn/init.cpp:273
#6  0x00005555555a542c in Main_Game (argc=1, argv=0x7fffffffe088)
    at /home/giulianob/bagunca/Vanilla-Conquer/tiberiandawn/conquer.cpp:135
#7  0x000055555563c0ff in main (argc=1, argv=0x7fffffffe088)
    at /home/giulianob/bagunca/Vanilla-Conquer/tiberiandawn/startup.cpp:454

The reason for this is because fopen is returning NULL for some files, and error is not being properly checked. After patching rawfile.cpp to show me the file it tried to open but failed, it shows me:

Could not read/write to file: temperat.pal
Could not read/write to file: temperat.pal

However, C&C95.exe binary runs fine in the same directory under Wine.

giulianobelinassi avatar Jan 21 '21 15:01 giulianobelinassi

Use retail data. CnCNet data is patched and incompatible with retail AFAIK.

hifi avatar Jan 21 '21 15:01 hifi

That did work. Thank you.

giulianobelinassi avatar Jan 21 '21 15:01 giulianobelinassi

I'm tagging this as a bug in handling file level error conditions as it should be more verbose and not crash, better if it just exits with an error.

hifi avatar Jan 26 '21 06:01 hifi

Some context here:

The original game has temperat.pal in cclocal.mix to use for displaying error messages before the main menu is shown (like not having a CD inserted, or not detecting a mouse). However, this prevented modding of temperat.pal since it was no longer loaded as part of the theater loading logic. So the name of the file from cclocal.mix that is used for this was changed to ccmenu.pal.

This of course means that when loading normally, the game will indeed not find a temperat.pal in the cclocal.mix of the 1.06 patch.

Nyerguds avatar Apr 08 '22 10:04 Nyerguds