| View previous topic :: View next topic |
| Author |
Message |
Sdw
Joined: 17 Jul 2007 Posts: 29
|
Posted: Tue Aug 14, 2007 9:44 pm Post subject: Loading data from 'current directory' |
|
|
I'm doing a small demo and I want to load my .mod file (using mikmod).
During development I loaded it from "ms0:/music.mod", that is the root of the memstick. However for a release, I want all my data contained in the same folder as the executable.
So I tested to put the mod-file in the same dir as the EBP (ms0:/PSP/GAME150/mydemo/music.mod) and then loaded it with just "music.mod" as filename. It worked fine for me (using 3.40OE and having my prod in the GAME150 dir).
However, is this the "correct" way to do it (that is, will it work for other firmwares etc.) or is there a situation where the executable will not be able to find it without having a full, absolute path? |
|
| Back to top |
|
 |
Mihawk
Joined: 03 Apr 2007 Posts: 29
|
Posted: Tue Aug 14, 2007 10:41 pm Post subject: |
|
|
This should work (i.e. just the filename without path). You could also use a sub dir (e.g. "data/file.dat").
One problem I had where it didn't work was in a kernel app where I started a user thread and wanted to load a file in the user thread. Then you need to get the current working directory ("getcwd") in the kernel thread. _________________ Ask and it will be given to you; seek and you will find; knock and the door will be opened to you. |
|
| Back to top |
|
 |
Fanjita
Joined: 28 Sep 2005 Posts: 217
|
Posted: Wed Aug 15, 2007 5:32 am Post subject: |
|
|
Should be fine for executables, but just be aware that it doesn't work for PRXs - although they maintain a record of their current directory, that isn't set to any useful initial value. _________________ Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you! |
|
| Back to top |
|
 |
Sdw
Joined: 17 Jul 2007 Posts: 29
|
Posted: Wed Aug 15, 2007 10:45 pm Post subject: |
|
|
| Alright, looks like I was on the right track then. Thanks for the answers guys! |
|
| Back to top |
|
 |
|