-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crashes when going to the title screen #1
Comments
I never tested it on macOS, my guess is that some of the constants that I used for open/mmap/SDL_* are different on macOS. Does it run at all, or just crash right away? |
The gamefreak logo and pokemon fight intro plays, then when it fades to white and is about to show the title screen, it crashes. Skaermoptagelse.2021-05-28.kl.21.11.53.mov |
ah, I know what this is. I mmap the sav file and use |
Creating a 32KB save file using Edit: #include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
int main(int argc, char** argv) {
int test = open("test.bin", O_CREAT | O_RDWR, 0644);
if (ftruncate(test, 32768) != 0) {
perror("test"); //doesn't happen, even when it seems to fail
}
close(test);
return 0;
}
Huh |
It's supposed to do that. On POSIX filesystems, there's a difference between how much data a file contains versus how much space it consumes. For example, on my Linux system, the I/O block size is 4,096 bytes, so even a 1-byte file will consume 4KB:
As you can see, the file is exactly 1 byte long, containing only The same thing works in the opposite direction: if you
The file is now 32,768 bytes long, containing an |
@Screwtapello thanks for the explanation! I wonder if there's a short way to get the behavior I want -- create or open a file of a fixed size on both macOS and Linux. Any ideas? |
I had a brief search for ftruncate-related issues on macOS, and I think (based on the age of Stack Overflow answers) that the HFS+ filesystem used by older versions didn't support sparse (size larger than storage) files. I expect that's fixed with modern APFS disks, and regardless, that should be the portable way to make a file of a fixed size. A segfault is a pretty typical result of writing beyond the Things to check:
|
Thanks! I don't have a mac to test on so it's a bit tough for me. At least on my linux laptop it looks reasonable:
|
For anybody looking for an easy copy-paste workaround: dd if=/dev/zero of=rom.sav bs=1 count=32k |
Ubuntu18.04 coredump |
Since this crash has been observed on Linux, I thought I'd try it myself, but I can't reproduce it (Debian Testing, Linux 5.10 on XFS). Here's a shell-command to run from the directory containing
Explain this command...
If I run the above command on my system, and close the pokegb window once the title-screen appears and "Blue Version" scrolls into place, I get the following output:
Explain this output...
It's likely that results of
As expected, the If somebody who can reproduce this crash on Linux can run that command and paste the output here, we might be able to figure out what's going on. |
This would be nice to fix, but in the meantime I added a simple workaround. You can run |
interesting |
Removes mmap() and other non-portable instructions. Only SDL2 functions are used now. Tested working on Windows 10 in a MinGW64 development environment. This may fix issue binji#1, whereby a crash happens if rom.sav is not found. Now, if rom.sav is not found, 32kB is allocated, and then later saved on exit. Not tested on macOS. Signed-off-by: Mahyar Koshkouei <mk@deltabeard.com>
ROM MD5:
50927e843568814f7ed45ec4f944bd8b
crash info from macOS
The text was updated successfully, but these errors were encountered: