Homebrew programming question

pka4916

Well-Known Member
OP
Member
Joined
May 24, 2006
Messages
206
Trophies
1
Location
USA
XP
422
Country
United States
hi, hope someone can help me with this,

I'm trying to find out how to get the picture out of the rom
and determ what the trimsize could be.

i am thinking that from reading on
http://www.bottledlight.com/ds/index...mats/NDSFormat

that this will show the size?
ROM size 0x080 0x083 4 0x00EE3E44

how can i calculate those values to get the right trim size?
i tried several things, but it just doesnt add up.

maybe someone can help me out with this.
I am using Delphi btw.

thank you so much
 

hankchill

I Pwn n00bs.
Member
Joined
Nov 5, 2005
Messages
2,338
Trophies
0
Age
38
Location
Outer Space
Website
www.hankchill.com
XP
421
Country
Canada
You need to understand exactly how it works to get the trim size, yes those are the correct locations in the rom for finding the trim size, but it needs to be reversed, so the trimsize will be 0x083 + 0x082 + 0x081 + 0x080, not the other way around.

After you figure that, it will give the proper rom length in hex.
 

pka4916

Well-Known Member
OP
Member
Joined
May 24, 2006
Messages
206
Trophies
1
Location
USA
XP
422
Country
United States
so,

I had this (from rom DQM) 128mb and trimsize = 83.5 mb (according to rominator)


GRomsize: array [0..3] of Byte


Seek(129,0); (pos 129 in the rom file)
Read(gromsize,4); read the 4 bytes

result is (180, 56, 5, 0)

so reading it back wards would be 0 , 5 , 56, 180

what do i need to do from here then? since i was making it 556180 as size
but don't know if it bytes,kb,mbit
 

anoNL

Active Member
Newcomer
Joined
Sep 27, 2008
Messages
32
Trophies
0
XP
55
Country
Netherlands
pka4916 said:
so,

I had this (from rom DQM) 128mb and trimsize = 83.5 mb (according to rominator)


GRomsize: array [0..3] of Byte


Seek(129,0); (pos 129 in the rom file)
Read(gromsize,4); read the 4 bytes

result is (180, 56, 5, 0)

so reading it back wards would be 0 , 5 , 56, 180

what do i need to do from here then? since i was making it 556180 as size
but don't know if it bytes,kb,mbit
http://en.wikipedia.org/wiki/Endianness
You're trying to read a 4-byte word in little endian.

unsigned int result = (b[3]
 

hankchill

I Pwn n00bs.
Member
Joined
Nov 5, 2005
Messages
2,338
Trophies
0
Age
38
Location
Outer Space
Website
www.hankchill.com
XP
421
Country
Canada
pka4916 said:
after reading the wiki, i am more confused now.

Maybe should start with something a little more simpler?
smile.gif
 

sypherce

Member
Newcomer
Joined
Dec 4, 2008
Messages
19
Trophies
1
Age
35
Location
USA, New York
Website
ds2key.1emu.net
XP
924
Country
United States
The following should do what you want, given that the rom is at rom.nds in the same directory. Since your last post was 3 days ago, you likely figured out your problem, but I was bored so I decided to write up the code anyways.

Code:
program DataFiles;

var
ÂÂÂÂf: file of byte;
ÂÂÂÂb1: byte;
ÂÂÂÂb2: byte;
ÂÂÂÂb3: byte;
ÂÂÂÂb4: byte;
ÂÂÂÂli: longint;

begin
ÂÂÂÂassign(f,'rom.nds');
ÂÂÂÂreset(f);

ÂÂÂÂseek(f,128);
ÂÂÂÂread(f,b1);
ÂÂÂÂread(f,b2);
ÂÂÂÂread(f,b3);
ÂÂÂÂread(f,b4);
ÂÂÂÂclose(f);

ÂÂÂÂli := (b4 shl 24) or (b3 shl 16) or (b2 shl 8) or b1;

ÂÂÂÂwrite(li);
end.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Veho @ Veho: Her boob is the cause of all this current shit :angry: