Right... to create a romdisk (as i don't believe KOS can see the root of the CDI):
- create an empty directory somewhere... call it 'romdisk'
- add in the files that you want the application to see:
Code:
/romdisk
-openttd.cfg
/data
opntitle.dat...
etc...
/lang
english.lng
- now go back to the parent folder so you can see the romdisk dir.
- convert to an img and then a linkable object:
Code:
$KOS_GENROMFS -f romdisk.img -d romdisk -v
$KOS_BASE/utils/bin2o/bin2o romdisk.img romdisk_boot romdisk.o
- add the following under the KOS INIT in unix.cpp:
Code:
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
- and also spew some fprintf (or enable debugging levels, feel free to tell me how!!) to see where the code gets to. (currently the fopen in FileExists is the killer)
You now have a disk that will be mounted RO at /rd and you can then access all required files... save-games will be an entirely separate issues...
High scores, etc... will need to be disabled appropriately...
I'm curious... what output are you seeing in the console and are you getting past the fopen issue? You never know.. it may be my environment screwing up.
I had to use the follow command line to get rid of the issues with directory structures and it trying to use /usr/local/* :
Code:
./configure --host=kos --prefix-dir="" --data-dir="rd" --without-personal-dir
...I've added in the following code to fios.cpp:
Code:
fprintf(stderr,"Attempting to see if %s [%s] exists...",filename,OTTD2FS(filename));
FILE *f = fopen(OTTD2FS(filename), "r");
if (f == NULL) {
fprintf(stderr,"NOT FOUND!\n");
return false;
}
fprintf(stderr,"FOUND IT FOUND IT FOUND IT!\n");
fclose(f);
and I get:
Code:
fs_romdisk: mounting image at 0x8c2b7f60 at /rd
maple: attached devices:
A0: Dreamcast Controller (01000000: Controller)
A1: Emulated VMU (02000000: MemoryCard)
A2: Emulated VMU (02000000: MemoryCard)
B0: Dreamcast Controller (01000000: Controller)
Attempting to see if /openttd.cfg [/openttd.cfg] exists...NOT FOUND!
Attempting to see if /openttd.cfg [/openttd.cfg] exists...NOT FOUND!
Attempting to see if /rd/openttd.cfg [/rd/openttd.cfg] exists...
...it just sits there hanging when the file does actually exist... to me this means that fopen is being called... but then fails afterwards?
I've just used the Dev ISO R3 and it still craps out... so there is something in our build process which is swapping another implementation of fopen? or a call that fopen makes? ... It's really beyond my knowledge.
I do know though, that back in the day, I'd been using cygwin and the Dev ISO and I got it all working... I don't remember switching away from fopen... but I did compile everything by hand (i.e. the source compiling and linking...)... since I had no real knowledge of the build system.
To me, this means that the final link could be killing it... or something to that effect... but I have no idea how.
...and after numerous re-ordering and adding/removing libraries i _cannot_ get past the fopen issue... strangely I can use fopen in the other examples
