Pxml Appdata Setup Script Not Working


purplepup

Member
Joined
Sep 12, 2006
Messages
102
Location
Southampton, UK
Website
Visit site
Hi all

I'm trying to get my old GP2X Reword game running on my Pan as a .pnd, and all is fine apart from the hiscore file not being saved to the appdata directory on exit. The appdata/reword.purplepup directory is being created automatically, but my (below) scripted appdata/reword.purplepup/data/pandora structure is not created and therefore ./data/pandora/hiscore.dat doesn't show up when the game exits.

I'm sure it's something simple but after trawling through the pnd and pxml wiki pages and mounting other peoples pnd's and looking at their startup scripts, I still can't see what's wrong.

I've tried the following run_reword.sh as the pnd executable
Code:
#!/bin/bash

# create the pandora subdirs if not exist so 
# we can save score file to it from the game
if [ -f ./data/pandora/hiscore.dat ]; then
echo "user hiscore.dat exists"
else
mkdir -p ./data/pandora
cp ./data/pandora/pnd_blank_hiscore.dat ./data/pandora/hiscore.dat
fi

#tried this too, i.e. always try, no overwrite, but fails too
#mkdir -p ./data/pandora
#cp -n ./data/pandora/pnd_blank_hiscore.dat ./data/pandora/hiscore.dat

./reword

If I create the appdata/reword.purplepup/data/pandora/ directory manually, then the hiscore.dat is saved correctly as I would expect. It's just the creation of these initial appdata directories...

Thanks
Al
 
It look like "./data/pandora" is already part of the PND.
So your mkdir won't do anything as it will already exist in the pnd. So this directory is not created in the appdata directory.
then the cp will try to copie the file from the pnd to the appdata sub-directory (which haven't been created...) and so fail.

You have 2 solutions to work around this problem :
1) don't have "data/pandora" as part of the pnd "name this data_pnd/pandora" and copy all needed files on startup. (I use this method for the Zelda games)
2) guess where is the appdata directory :
Code:
PND_FILE=$(losetup -a|grep reword|sed 's/.*(//;s/)//')
MOUNT_POINT=$(echo $PND_FILE|awk -F/ '{print "/"$2"/"$3}')
mkdir -p ${MOUNT_POINT:-"/media/mmcblk0p1"}/pandora/appdata/reword.purplepup/data/pandora
Warning I never used this before. I just thinked about this when reading you. you may need to fix the syntax/logic
 
Ah, I see.

So if I keep the current pnd structure and create a scores/ directory and put the hiscore.dat in there it should work.

Cool, thanks for explaining that.
If I need more directory messing in the future, I'll maybe use your 'find' approach or something like it.

Thanks again
Al
 
Hmmm, this is annoying. Even if I try to create a file or directory that does not exist in the pnd file, it still doesn't create it (and obviously the scorefile doesn't then get copied or updated).

This is the output in /tmp/pndrunreword.purplepup.out I don't know if it tells anybody anything useful.
Code:
in fork!
PND ++ /media/mmcblk2p1/pandora/apps//reword.pnd
mountpoint: /media/mmcblk2p1
Basename: reword.purplepup
mkdir -p /mnt/pnd/reword.purplepup
mkdir -p /media/mmcblk2p1/pandora/appdata/reword.purplepup
/mnt/utmp/reword.purplepup
/usr/pandora/scripts/pnd_run.sh: line 124: [: !: integer expression expected
not mounted on loop yet, doing so
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
LoopMountedon: 
losetup: could not find any free loop device

usedminor 2
freeminor 3
Filetype is Squashfs
sudo mount -t squashfs  /dev/loop3
mounting union!
Filesystem is vfat
app exited
rmdir: failed to remove `/mnt/utmp/reword.purplepup': Device or resource busy
rm: cannot remove `/mnt/utmp/reword.purplepup': Is a directory
rmdir: failed to remove `/media/mmcblk2p1/pandora/appdata/reword.purplepup/.wh..wh.plnk': No such file or directory
rmdir: failed to remove `/media/mmcblk2p1/pandora/appdata/reword.purplepup/.wh..wh..tmp': No such file or directory
rmdir: failed to remove `/media/mmcblk2p1/pandora/appdata/reword.purplepup/': Directory not empty
cleanup done

I don't really want to start making copies of the pnd directory structure and files (although I don't think I could if I wanted to at the moment) so is there anything else I could try?

Thanks
 
Ok, I've fixed it with a bodge for now, by just saving the score file to the root of my working (appdata/reword.purplepup) directory.

Not how I want to do it, but unless someone can come up with a sure fire way of creating these directories, I'll have to do that for now.

Hoping someone has some ideas...
Thanks
 
Back
Top