diff options
author | UnavailableDev <69792062+UnavailableDev@users.noreply.github.com> | 2023-03-22 10:45:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-22 10:45:34 +0100 |
commit | d32a4942c7e16af5daf71a769906b17cb44de8e1 (patch) | |
tree | 8da86d27d30d841d786a5beca634e3fbaaf00570 /test/bin/test_file_read.c | |
parent | 6d82f9e3d165e0200bed2f2784a1183f47b37fa3 (diff) | |
parent | 7f51cd925883bbf958baa289d4d19231667c9eba (diff) |
Merge branch 'lonkaars:dev' into dev
Diffstat (limited to 'test/bin/test_file_read.c')
-rw-r--r-- | test/bin/test_file_read.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/bin/test_file_read.c b/test/bin/test_file_read.c new file mode 100644 index 0000000..df93395 --- /dev/null +++ b/test/bin/test_file_read.c @@ -0,0 +1,46 @@ + +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> + + +#define HH_PPU_VRAM_TMM_SPRITE_SIZE 52 + + +void printData(uint8_t* in) { + for (int i = 0; i < HH_PPU_VRAM_TMM_SPRITE_SIZE; i++) + { + printf("%02x ",in[i]); + } + printf("\n"); +} + +void hh_ppu_load_tilemap() { + + + char* filename = "slime.bin"; + FILE* fp = fopen(filename,"rb"); + if (!fp){ + return;//error + } + + int sprite_size = (16 * 16); + fseek(fp, 0, SEEK_END); + int _size = ftell(fp)/sprite_size; + rewind(fp); + // printf("%i",_size); + for (int i = 0; i < _size; i++) { + uint8_t data[sprite_size]; + fread(data,1,sprite_size,fp); + + printData(data); + } + fclose(fp); + +} + + +int main(){ +hh_ppu_load_tilemap(); + return 0; +} |