aboutsummaryrefslogtreecommitdiff
path: root/src/ppusim
diff options
context:
space:
mode:
authorFlenk008 <frenk_0_0@hotmail.com>2023-03-13 18:04:59 +0100
committerFlenk008 <frenk_0_0@hotmail.com>2023-03-13 18:04:59 +0100
commit47c76e5eabd2b7aa4eb0de7ca34b4ef9ac78f395 (patch)
treed6f75676ba9f544910cc3e49e4e3f3a49cb15d7a /src/ppusim
parent91c9d1c9fc13cf163c6262437de16c992dadaa5b (diff)
Revert "Revert "Merge branch 'dev' of https://github.com/Flenk008/avans-arcade into dev""
This reverts commit a9ad8e0a8ac5346108f1e2c1a0bf9360fadc20da.
Diffstat (limited to 'src/ppusim')
-rw-r--r--src/ppusim/sim.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/ppusim/sim.c b/src/ppusim/sim.c
index 1fceb82..a5fec45 100644
--- a/src/ppusim/sim.c
+++ b/src/ppusim/sim.c
@@ -29,20 +29,21 @@ void hh_ppu_init() {
}
void hh_ppu_load_tilemap() {
- char* filename = "tiles.bin";
+ char* filename = "../test/bin/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)/HH_PPU_VRAM_TMM_SPRITE_SIZE;
+ int _size = ftell(fp)/sprite_size;
fseek(fp, 0, 0);//goto start of file
for (int i = 0; i < _size; i++) {
- uint8_t data[HH_PPU_VRAM_TMM_SPRITE_SIZE];
+ uint8_t data[sprite_size];
- fread(data,HH_PPU_VRAM_TMM_SPRITE_SIZE,1,fp);
+ fread(data,sizeof(uint8_t),sprite_size,fp);
hh_s_ppu_vram_data sprite = hh_ppu_2nat_sprite(data);
sprite.offset = i*HH_PPU_VRAM_TMM_SPRITE_SIZE;