fopen fails to open files on CD sometimes

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
mrneo240
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 36
Joined: Wed Mar 14, 2018 12:22 am
Has liked: 0
Been liked: 5 times

fopen fails to open files on CD sometimes

Post by mrneo240 » Wed Apr 03, 2019 5:01 pm

As title

During the course of running a program fopen can start failing to open files.

Why? What can I do?

Thoughts on how to fix? Known issue?

These are simple files on a CD that are in a 2nd level folder and have names like "file.dat"
mrneo240
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 36
Joined: Wed Mar 14, 2018 12:22 am
Has liked: 0
Been liked: 5 times

Re: fopen fails to open files on CD sometimes

Post by mrneo240 » Wed Apr 03, 2019 6:55 pm

further info, you can see the directory listing mysteriously fails after failing to open pak4.pak

Code: Select all

Added packfile /cd/data/goldcup/pak1.pak (23 files)
Reading: /cd/data/goldcup
config.cfg  /  2252
gfx.wad  /  112828
launcher.cfg  /  329
pak0.pak  /  4111097
pak1.pak  /  3074991
pak2.pak  /  1508324
pak3.pak  /  7331896
progs.dat  /  487752
qcr.txt  /  6065
rally.cfg  /  3675
readme.txt  /  209
Complete!
Added packfile /cd/data/goldcup/pak2.pak (5 files)
Reading: /cd/data/goldcup
config.cfg  /  2252
gfx.wad  /  112828
launcher.cfg  /  329
pak0.pak  /  4111097
pak1.pak  /  3074991
pak2.pak  /  1508324
pak3.pak  /  7331896
progs.dat  /  487752
qcr.txt  /  6065
rally.cfg  /  3675
readme.txt  /  209
Complete!
Added packfile /cd/data/goldcup/pak3.pak (74 files)
Reading: /cd/data/goldcup
Complete!
[Sys_FileOpenRead] Error opening /cd/data/goldcup/pak4.pak: Success
Couldn't open /cd/data/goldcup/pak4.pak
Playing registered version.
COM_FindFile: Looking to find |gfx.wad|
PackFile: /cd/data/goldcup/pak0.pak : gfx.wad
Console initialized.
Exe: 15:21:33 Apr  3 2019
 8.0 megabyte heap
COM_FindFile: Looking to find |gfx/palette.lmp|
COM_FindFile: searching: |/cd/data/goldcup/gfx/palette.lmp|
[Sys_FileTime]
Reading: /cd/data/goldcup
Complete!
[Sys_FileTime] Error opening |/cd/data/goldcup/gfx/palette.lmp| errno=9 | Bad file number
fopen: Bad file number
Not Found!
PackFile: /cd/data/id1/pak2.pak : gfx/palette.lmp
COM_FindFile: Looking to find |gfx/colormap.lmp|
COM_FindFile: searching: |/cd/data/goldcup/gfx/colormap.lmp|
[Sys_FileTime]
Reading: /cd/data/goldcup
Complete!
BB Hood
Insane DCEmu
Insane DCEmu
Posts: 168
Joined: Fri Mar 30, 2007 12:09 am
Has liked: 1 time
Been liked: 0

Re: fopen fails to open files on CD sometimes

Post by BB Hood » Wed Apr 03, 2019 8:16 pm

Solution from the discord:

Max files you can open from CD is 8
kos/kernel/arch/dreamcast/include/dc/fs_iso9660.h : #define MAX_ISO_FILES 8

Hey BlueCrab maybe we can bump up this value up to 16?
Post Reply