Commit 48f08926 authored by Derrick Sobodash's avatar Derrick Sobodash

Added byuu's title screen hack

parent 94ed6114
@copy l2_j.bin l2.bin>nul
nonas comp.asm l2.bin
nonas strings.asm l2.bin
@pause
\ No newline at end of file
#include <stdio.h>
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long ulong;
byte bmp16_header[]={
0x42,0x4D,0x76,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x00,0x00,0x28,0x00,
0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x00,0x00,0xC4,0x0E,0x00,0x00,0xC4,0x0E,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00
};
byte palette_8x8font[]={
0x00, 0x00, 0x00, 0x00,
0xff, 0x00, 0x00, 0x00,
0x3f, 0x3f, 0x3f, 0x00,
0xff, 0xff, 0xff, 0x00,
0xff, 0xff, 0xff, 0x00,
0xbf, 0xbf, 0xbf, 0x00,
0x00, 0xff, 0xff, 0x00,
0xff, 0x00, 0x00, 0x00,
0xff, 0x00, 0xff, 0x00,
0xff, 0xff, 0x00, 0x00,
0x00, 0x00, 0x7f, 0x00,
0x00, 0x7f, 0x00, 0x00,
0x00, 0x7f, 0x7f, 0x00,
0x7f, 0x00, 0x00, 0x00,
0x7f, 0x00, 0x7f, 0x00,
0x7f, 0x7f, 0x00, 0x00,
};
byte *data;
ulong __width, __height;
void setpixel(ulong x, ulong y, byte c) {
int __y;
__y = (__height - 1) - y;
c&=0x0f;
if((x&1) == 0) {
data[(__y*__width+x)>>1] =c<<4;
} else {
data[(__y*__width+x)>>1]|=c;
}
}
void bintobmp(char *dfn, char *sfn, ulong width, ulong height, byte *palette) {
FILE *fp, *wr;
int x, y, x1, y1, z;
__width = width;
__height = height;
fp=fopen(sfn, "rb");
if(!fp)return;
wr=fopen(dfn, "wb");
data=(byte*)malloc(width*height/2);
memset(data, 0, width*height/2);
for(y=0;y<height;y+=8) {
for(x=0;x<width;x+=8) {
for(y1=0;y1<8;y1++) {
for(x1=0;x1<8;x1+=2) {
z=fgetc(fp);
setpixel(x+x1, y+y1, (z>>4));
setpixel(x+x1+1, y+y1, z);
}
}
}
}
bmp16_header[0x12]=width;
bmp16_header[0x13]=width>>8;
bmp16_header[0x16]=height;
bmp16_header[0x17]=height>>8;
fwrite(bmp16_header, 1, 0x36, wr);
fwrite(palette, 1, 0x40, wr);
fwrite(data, 1, width*height/2, wr);
fclose(fp);
fclose(wr);
}
int main() {
bintobmp("data/font8j.bmp", "data/font8j.bin", 128, 128, palette_8x8font);
return 0;
}
#include <stdio.h>
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long ulong;
byte *data;
ulong __width, __height;
byte getpixel(ulong x, ulong y) {
int __y;
__y = (__height - 1) - y;
if((x&1) == 0) {
return (data[(__y*__width+x)>>1]>>4)&0x0f;
} else {
return (data[(__y*__width+x)>>1])&0x0f;
}
}
void bmptobin(char *dfn, char *sfn, ulong width, ulong height) {
FILE *fp, *wr;
int x, y, x1, y1, z;
__width = width;
__height = height;
fp=fopen(sfn, "rb");
if(!fp)return;
fseek(fp, 0x76, SEEK_SET);
wr=fopen(dfn, "wb");
data=(byte*)malloc(width*height/2);
fread(data, 1, width*height/2, fp);
fclose(fp);
for(y=0;y<height;y+=8) {
for(x=0;x<width;x+=8) {
for(y1=0;y1<8;y1++) {
for(x1=0;x1<8;x1+=2) {
z=getpixel(x+x1, y+y1)<<4;
z|=getpixel(x+x1+1, y+y1);
fputc(z, wr);
}
}
}
}
fclose(wr);
}
int main() {
bmptobin("data/font8.bin", "data/font8.bmp", 128, 128);
bmptobin("data/title_raw.bin", "data/title.bmp", 224, 64);
return 0;
}
gcc bintobmp.c -s -o bintobmp.exe
gcc bmptobin.c -s -o bmptobin.exe
gcc titleopt.c -s -o titleopt.exe
@pause
\ No newline at end of file
;expand rom size to 24mbit
org $200000 : fill $100000
;edit rom header to use 24mbit
org $0001a0 : dd $00000000 : dd $002fffff
;updated compressed data pointers to new locations
org $0b0004 : dd $00200000 ;8x8 font
org $0b0624 : dd $00204000 ;title screen tiledata
;insert 8x8 font
org $200000
db $00 ;compression type: none
dw $2000 ;decompressed size
incbin data/font8.bin
;insert title screen tilemap
org $0a4299 : incbin data/title_map.bin
;insert title screen tiledata
org $00204000
db $00 ;compression type: none
dw $1760 ;decompressed size
incbin data/title.bin
=20
\=ff
.=2e
A=41
B=42
C=43
D=44
E=45
F=46
G=47
H=48
I=49
J=4a
K=4b
L=4c
M=4d
N=4e
O=4f
P=50
Q=51
R=52
S=53
T=54
U=55
V=56
W=57
X=58
Y=59
Z=5a
a=b1
b=b2
c=b3
d=b4
e=b5
f=b6
g=b7
h=b8
i=b9
j=ba
k=bb
l=bc
m=bd
n=be
o=bf
p=c0
q=c1
r=c2
s=c3
t=c4
u=c5
v=c6
w=c7
x=c8
y=c9
z=ca
0=30
1=31
2=32
3=33
4=34
5=35
6=36
7=37
8=38
9=39
File added
table data/font8.tbl
org $0a3941 : db ' '
org $0a39a3 : db ' '
org $0a39dc : db ' '
org $0a3a17 : db ' '
org $0a3a52 : db ' '
org $0a3a5e : db ' '
org $0a3a91 : db ' '
org $0a394b : db 'A B C D E a b c d e . . . . .'
org $0a397a : db 'F G H I J f g h i j . . . . .'
org $0a39b5 : db 'K L M N O k l m n o . . . .'
org $0a39ee : db 'P Q R S T p q r s t 0 1 2 3 4'
org $0a3a29 : db 'U V W X Y u v w x y 5 6 7 8 9'
org $0a3a68 : db 'Z . . . . z . . . . Next Back'
org $0a3a91
db $fe,$04,$20
db ' '
db $fe,$0e,$20
db $06,$07,$06,$07
db ' '
db '. . . . . . . . . . Done'
db $fe,$08,$20
org $0a450f
db 'Press START Button',$ff
#include <stdio.h>
#define null 0xffffffff
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long ulong;
FILE *fp, *wr, *map;
byte *data;
byte tileset[0xe0][32];
byte tile_count = 0;
ulong find_tile(ulong num) {
int i, l, m;
for(i=0;i<tile_count;i++) {
m=0;
for(l=0;l<32;l++) {
if(tileset[i][l] == data[num*32+l])m++;
}
if(m == 32)return i;
}
return null;
}
void insert_tile(ulong num) {
int i;
ulong found = find_tile(num);
if(found != null) {
fputc(found, map);
} else {
for(i=0;i<32;i++) {
tileset[tile_count][i] = data[num*32+i];
}
fputc(tile_count++, map);
}
}
int main() {
int i;
fp=fopen("data/title_raw.bin", "rb");
if(!fp)return 0;
data=(byte*)malloc(0x1c00);
fread(data, 1, 0x1c00, fp);
fclose(fp);
memset(tileset, 0, 0xe0*32);
map=fopen("data/title_map_raw.bin", "wb");
for(i=0;i<0xe0;i++)insert_tile(i);
fclose(map);
wr=fopen("data/title.bin", "wb");
for(i=0;i<tile_count;i++) {
fwrite(tileset[i], 1, 32, wr);
}
fclose(wr);
//cut off 5 bytes from the bottom right, it will
//still display properly, as these tiles are all
//blank in title.bmp. I do this because there is
//no room for all 0xe0 bytes in the rom.
fp=fopen("data/title_map_raw.bin", "rb");
fread(data, 1, 0xdb, fp);
fclose(fp);
wr=fopen("data/title_map.bin", "wb");
fwrite(data, 1, 0xdb, wr);
fclose(wr);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment