I quit trying to format the HDD... Will this code work???

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
sparrow
Posts: 24
Joined: Thu Apr 13, 2006 3:36 am
Contact:

I quit trying to format the HDD... Will this code work???

Post by sparrow »

Hi everybody!

I am kinda quitting trying to format the HDD by myself by using libhdd: http://forums.ps2dev.org/viewtopic.php?t=5457

Now I just got an (ugly) idea, which consists of embedding DMS HDD Format Tool inside my application. Now I don't know if the following code will execute DMS HDD Format Tool (I have to try it when I get home, but I would like to hear some opinions here before that :-):

Code: Select all

#include <kernel.h>
#include <sifrpc.h>
#include <debug.h>

extern u8 *hddfrmt_elf; // This is HDD Format Tool 1.1, which is embedded into my APP!
extern int size_hddfrmt_elf;

typedef struct
&#123;
   u8	ident&#91;16&#93;;
   u16	type;
   u16	machine;
   u32	version;
   u32	entry;
   u32	phoff;
   u32	shoff;
   u32	flags;
   u16	ehsize;
   u16	phentsize;
   u16	phnum;
   u16	shentsize;
   u16	shnum;
   u16	shstrndx;
&#125; elf_header_t;

int main&#40;void&#41;
&#123;
   elf_header_t *eh = &#40;elf_header_t *&#41; hddfrmt_elf;
   SifExitRpc&#40;&#41;;
   FlushCache&#40;0&#41;;
   ExecPS2&#40;&#40;void *&#41;eh->entry, 0, 0, NULL&#41;; // Executes HDD Format Tool 1.1
   SleepThread&#40;&#41;;
   return 0;
&#125;
This is the corret way of executing an ELF which is in memory (embedded)? This code will execute the HDDFRMT.ELF file?

Thanks in advance!

sparrow[/quote]
sparrow
Posts: 24
Joined: Thu Apr 13, 2006 3:36 am
Contact:

Post by sparrow »

This is not needed anymore, cos I could format the HDD by using libhdd!! :D
Post Reply