diff options
author | UnavailableDev <ggwildplay@gmail.com> | 2023-04-03 10:09:40 +0200 |
---|---|---|
committer | UnavailableDev <ggwildplay@gmail.com> | 2023-04-03 10:09:40 +0200 |
commit | 05504df10934cac60b774fb10e86593ec3897510 (patch) | |
tree | 89a418bb7477904f394e460d5e661c3047117030 /test | |
parent | 54c3e1139e3e0e328f7ce3e8a2a61b0bf530a772 (diff) | |
parent | 0a014f39c375c0cf28de70ebaab6cb0a5266f3c2 (diff) |
Merge branch 'dev' of https://github.com/UnavailableDev/avans-arcade into dev
Diffstat (limited to 'test')
-rw-r--r-- | test/bin/exportingPalettes.md | 4 | ||||
-rw-r--r-- | test/bin/test_file_read.c | 46 |
2 files changed, 50 insertions, 0 deletions
diff --git a/test/bin/exportingPalettes.md b/test/bin/exportingPalettes.md new file mode 100644 index 0000000..be4a354 --- /dev/null +++ b/test/bin/exportingPalettes.md @@ -0,0 +1,4 @@ +```sh +cat test.src|head -n 46 | awk '{printf "%02x: {0x%x,0x%x,0x%x}\n",NR,$1/2,$2/2,$3/2 }' > hex_palettes +``` + 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; +} |