VMU Game Uploader

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

VMU Game Uploader

Postby Light-Dark on Sat Jun 03, 2017 11:59 pm

Posted this over on DCEmu programming forum but I figured there may be some people here who are interested in this;

I've been working on writing a new game engine for the Dreamcast and so I've looked into putting vmu games onto the vmu through KOS. Couldn't find any good examples out there of how to do so I decided to make my own;

EDIT: (Better solution)

Before you can use this demo you have to do a bit of digging in KOS itself, specifically for the vmufs.c file, on line 750:
nd.hdroff = (flags & VMUFS_VMUGAME) ? 1 : 0;


Make sure the header offset value is set to 1 instead of 0 if the VMUFS_VMUGAME flag is set, otherwise your VMU will say "this game is damaged" when you try to play what you have uploaded. Once you have made sure of this, recompile KOS and you should be able to upload your VMS file to the VMU no problem. I've included Marcus Comstedt's Tiny Tetris within the demo. Hopefully this is helpful.
vmu_game.tar
(10 KiB) Downloaded 15 times
Last edited by Light-Dark on Mon Aug 07, 2017 7:47 pm, edited 1 time in total.
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step

Image
User avatar
Light-Dark
Dreamcast Developer
Dreamcast Developer
 
Posts: 317
Joined: Sun Mar 13, 2011 8:57 pm
Location: Canada

Re: VMU Game Uploader

Postby Falco Girgis on Wed Jul 19, 2017 4:09 pm

Jesus Christ, are you SURE you have to recompile all of KOS to do that!? That's absolutely horrible.

That offset is supposed to be 0 for DATA type files, where the header comes first then the data comes next. This is how standard save files work. Then GAME files require the header to be located at the first block, because block 0 is reserved for interrupt service routines and shit. So the layout in VMU flash is:

BLOCK 1: ISR Routines and Shit
BLOCK 2: VMS Header Data
BLOCK 3+: VMU Game Code

If KOS actually has to be recompiled like that, then how is it possible for DC homebrew like Pier Solar to save BOTH GAME and DATA files on a single VMU in a single executable?
"So what happens if the Elysian Shadows Kickstarter fails?"
Image
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
 
Posts: 10693
Joined: Thu May 20, 2004 3:04 pm
Location: Studio Vorbis, AL

Re: VMU Game Uploader

Postby Light-Dark on Mon Aug 07, 2017 7:43 pm

Falco Girgis wrote:Jesus Christ, are you SURE you have to recompile all of KOS to do that!? That's absolutely horrible.

That offset is supposed to be 0 for DATA type files, where the header comes first then the data comes next. This is how standard save files work. Then GAME files require the header to be located at the first block, because block 0 is reserved for interrupt service routines and shit. So the layout in VMU flash is:

BLOCK 1: ISR Routines and Shit
BLOCK 2: VMS Header Data
BLOCK 3+: VMU Game Code

If KOS actually has to be recompiled like that, then how is it possible for DC homebrew like Pier Solar to save BOTH GAME and DATA files on a single VMU in a single executable?


Almost sure on this one. I used a VMU file explorer program ( the name of which is escaping me right now) and it has an option to "reformat" (or something like that) the VMU . Reformatting it fixed the "this game is damaged" error so I wondered what exactly it changed from my original standard KOS upload that made it work no problem. I then dumped an unmodified version and a reformatted version of the game I uploaded and wrote a program in C to isolate byte differences in the dumps and their locations in memory. I then went into the VMU drivers in KOS to check out whats going on with vmufs_write and found the header offset being set to 0 (regardless of whether or not you pass the flag determining whether you are writing a game or data).

Shit now that you mention that the offset should be 0 for Data (I didn't even think of that, thank you), I think this would probably be a more permanent solution:
nd.hdroff = (flags & VMUFS_VMUGAME) ? 1 : 0;
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step

Image
User avatar
Light-Dark
Dreamcast Developer
Dreamcast Developer
 
Posts: 317
Joined: Sun Mar 13, 2011 8:57 pm
Location: Canada

Re: VMU Game Uploader

Postby short on Wed Aug 09, 2017 11:03 am

why not just?

Code: Select all
nd.hdroff = (bool)(flags & VMUFS_VMUGAME);
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
User avatar
short
ES Beta Backer
ES Beta Backer
 
Posts: 570
Joined: Thu Apr 30, 2009 3:22 am
Location: Oregon, US

Re: VMU Game Uploader

Postby Light-Dark on Wed Aug 09, 2017 10:48 pm

short wrote:why not just?

nd.hdroff = (bool)(flags & VMUFS_VMUGAME);


That works.
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step

Image
User avatar
Light-Dark
Dreamcast Developer
Dreamcast Developer
 
Posts: 317
Joined: Sun Mar 13, 2011 8:57 pm
Location: Canada


Return to Programming Discussion

Who is online

Users browsing this forum: No registered users and 1 guest