aboutsummaryrefslogtreecommitdiff
path: root/src/ppusim
diff options
context:
space:
mode:
authorFlenk008 <frenk_0_0@hotmail.com>2023-03-13 18:02:59 +0100
committerFlenk008 <frenk_0_0@hotmail.com>2023-03-13 18:02:59 +0100
commita9ad8e0a8ac5346108f1e2c1a0bf9360fadc20da (patch)
treeb3b772e0fc396aa7d09d8581c61d68b963394ac4 /src/ppusim
parent4f489426e05fb3b296998b17859d8702cc4f37e1 (diff)
Revert "Merge branch 'dev' of https://github.com/Flenk008/avans-arcade into dev"
This reverts commit 4f489426e05fb3b296998b17859d8702cc4f37e1, reversing changes made to e47f7fa198229b8598b8ab03ef8b2483f7c685bc.
Diffstat (limited to 'src/ppusim')
-rw-r--r--src/ppusim/sim.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/ppusim/sim.c b/src/ppusim/sim.c
index a5fec45..1fceb82 100644
--- a/src/ppusim/sim.c
+++ b/src/ppusim/sim.c
@@ -29,21 +29,20 @@ void hh_ppu_init() {
}
void hh_ppu_load_tilemap() {
- char* filename = "../test/bin/tiles.bin";
+ char* filename = "tiles.bin";
FILE* fp = fopen(filename,"rb");
if (!fp){
- fprintf(stderr,"Error: Failed to load tiles.");
return;//error
}
- int sprite_size = (HH_PPU_SPRITE_WIDTH * HH_PPU_SPRITE_HEIGHT);
+
fseek(fp, 0, SEEK_END);//goto EOF
- int _size = ftell(fp)/sprite_size;
+ int _size = ftell(fp)/HH_PPU_VRAM_TMM_SPRITE_SIZE;
fseek(fp, 0, 0);//goto start of file
for (int i = 0; i < _size; i++) {
- uint8_t data[sprite_size];
+ uint8_t data[HH_PPU_VRAM_TMM_SPRITE_SIZE];
- fread(data,sizeof(uint8_t),sprite_size,fp);
+ fread(data,HH_PPU_VRAM_TMM_SPRITE_SIZE,1,fp);
hh_s_ppu_vram_data sprite = hh_ppu_2nat_sprite(data);
sprite.offset = i*HH_PPU_VRAM_TMM_SPRITE_SIZE;