mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-25 12:06:54 +01:00
Save db fixes
This commit is contained in:
parent
a0d7630e86
commit
1288d4fdcd
0
assets/.gitkeep
Normal file
0
assets/.gitkeep
Normal file
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#include <fatfs/ff.h>
|
#include <fatfs/ff.h>
|
||||||
|
|
||||||
//struct n64_rom_header
|
|
||||||
|
|
||||||
void menu_fileinfo(FILINFO current_fileinfo);
|
void menu_fileinfo(FILINFO current_fileinfo);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,7 +25,7 @@ void menu_info(void) {
|
|||||||
int16_t vertical_position = 40;
|
int16_t vertical_position = 40;
|
||||||
|
|
||||||
graphics_draw_text(disp, horizontal_start_position, vertical_position, "Menu Version:");
|
graphics_draw_text(disp, horizontal_start_position, vertical_position, "Menu Version:");
|
||||||
graphics_draw_text(disp, horizontal_indent,vertical_position += font_vertical_pixels, "Vx.x.x.x"); // FIXME: use global setting.
|
graphics_draw_text(disp, horizontal_indent,vertical_position += font_vertical_pixels, MENU_VERSION);
|
||||||
vertical_position += (font_vertical_pixels * 2);
|
vertical_position += (font_vertical_pixels * 2);
|
||||||
graphics_draw_text(disp, horizontal_start_position, vertical_position, "Authors:");
|
graphics_draw_text(disp, horizontal_start_position, vertical_position, "Authors:");
|
||||||
graphics_draw_text(disp, horizontal_indent, vertical_position += font_vertical_pixels, "JonesAlmighty / NetworkFusion");
|
graphics_draw_text(disp, horizontal_indent, vertical_position += font_vertical_pixels, "JonesAlmighty / NetworkFusion");
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef MENU_INFO_H__
|
#ifndef MENU_INFO_H__
|
||||||
#define MENU_INFO_H__
|
#define MENU_INFO_H__
|
||||||
|
|
||||||
|
#define MENU_VERSION "V0.0.0.3"
|
||||||
|
|
||||||
void menu_info(void);
|
void menu_info(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "../utils/str_utils.h"
|
#include "../utils/str_utils.h"
|
||||||
|
|
||||||
|
//const int max_files_on_screen = 16;
|
||||||
static int scroll_menu_position = 1;
|
static int scroll_menu_position = 1;
|
||||||
static int items_in_dir = 1;
|
static int items_in_dir = 1;
|
||||||
|
|
||||||
@ -48,10 +48,15 @@ void load_n64_rom() {
|
|||||||
printf("ROM checksum: %llu\n\n", temp_header.checksum);
|
printf("ROM checksum: %llu\n\n", temp_header.checksum);
|
||||||
|
|
||||||
// FIXME: if the ROM header does not make sense, it is an invalid ROM.
|
// FIXME: if the ROM header does not make sense, it is an invalid ROM.
|
||||||
|
wait_ms(5000); // wait used for debugging. Can be removed later.
|
||||||
|
|
||||||
|
|
||||||
uint8_t save_type = rom_db_match_save_type(temp_header);
|
uint8_t save_type = rom_db_match_save_type(temp_header);
|
||||||
|
|
||||||
printf("save type: %d\n", save_type);
|
printf("save type: %d\n", save_type);
|
||||||
|
|
||||||
|
wait_ms(5000); // wait used for debugging. Can be removed later.
|
||||||
|
|
||||||
sprintf(sd_path_buffer, "%s.%llu.sav", current_fileinfo.fname, temp_header.checksum);
|
sprintf(sd_path_buffer, "%s.%llu.sav", current_fileinfo.fname, temp_header.checksum);
|
||||||
wait_ms(5000); // wait used for debugging. Can be removed later.
|
wait_ms(5000); // wait used for debugging. Can be removed later.
|
||||||
|
|
||||||
@ -202,12 +207,30 @@ void menu_main_init (settings_t *settings) {
|
|||||||
|
|
||||||
if (joypad.c[0].A) {
|
if (joypad.c[0].A) {
|
||||||
// TODO: move this to a function and check that the ROM is valid by checking the header...
|
// TODO: move this to a function and check that the ROM is valid by checking the header...
|
||||||
if (str_endswith(current_fileinfo.fname, ".z64") || str_endswith(current_fileinfo.fname, ".n64") || str_endswith(current_fileinfo.fname, ".v64") || str_endswith(current_fileinfo.fname, ".rom")) {
|
if (str_endswith(current_fileinfo.fname, ".z64")) {
|
||||||
|
|
||||||
load_n64_rom();
|
load_n64_rom();
|
||||||
|
|
||||||
break; //required!
|
break; //required!
|
||||||
}
|
}
|
||||||
|
else if (str_endswith(current_fileinfo.fname, ".n64") || str_endswith(current_fileinfo.fname, ".v64") || str_endswith(current_fileinfo.fname, ".rom")) {
|
||||||
|
console_init();
|
||||||
|
console_clear();
|
||||||
|
|
||||||
|
printf("ROM : %s\n", current_fileinfo.fname);
|
||||||
|
printf("Not loading due to potential conversion issue.\n");
|
||||||
|
wait_ms(10000); // wait used for debugging. Can be removed later.
|
||||||
|
menu_main_refresh(current_dir);
|
||||||
|
}
|
||||||
|
else if (str_endswith(current_fileinfo.fname, ".zip")) {
|
||||||
|
console_init();
|
||||||
|
console_clear();
|
||||||
|
|
||||||
|
printf("ZIP : %s\n", current_fileinfo.fname);
|
||||||
|
printf("Not loading due to potential conversion issue.\n");
|
||||||
|
wait_ms(10000); // wait used for debugging. Can be removed later.
|
||||||
|
menu_main_refresh(current_dir);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (current_fileinfo.fattrib & AM_DIR) {
|
if (current_fileinfo.fattrib & AM_DIR) {
|
||||||
// if this is a directory we need to transverse to it!
|
// if this is a directory we need to transverse to it!
|
||||||
|
@ -75,15 +75,15 @@ uint8_t rom_db_match_save_type(rom_header_t rom_header) {
|
|||||||
return extract_homebrew_save_type(high_nibble);
|
return extract_homebrew_save_type(high_nibble);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second: Match the default entries for crc_high.
|
// // Second: Match the default entries for crc_high.
|
||||||
// FIXME: use full check code, or pad.
|
// // FIXME: use full check code, or pad.
|
||||||
if (rom_header.checksum == 0xbcb1f89f)return DB_SAVE_TYPE_EEPROM_4K; // kirby v1.3
|
// if (rom_header.checksum == 0xbcb1f89f)return DB_SAVE_TYPE_EEPROM_4K; // kirby v1.3
|
||||||
if (rom_header.checksum == 0x46039fb4)return DB_SAVE_TYPE_EEPROM_16K; // kirby U
|
// if (rom_header.checksum == 0x46039fb4)return DB_SAVE_TYPE_EEPROM_16K; // kirby U
|
||||||
if (rom_header.checksum == 0x0d93ba11)return DB_SAVE_TYPE_EEPROM_16K; // kirby U
|
// if (rom_header.checksum == 0x0d93ba11)return DB_SAVE_TYPE_EEPROM_16K; // kirby U
|
||||||
if (rom_header.checksum == 0xce84793d)return DB_SAVE_TYPE_SRAM; // donkey kong f2
|
// if (rom_header.checksum == 0xce84793d)return DB_SAVE_TYPE_SRAM; // donkey kong f2
|
||||||
if (rom_header.checksum == 0x4cbc3b56)return DB_SAVE_TYPE_SRAM; // DMTJ 64DD game
|
// if (rom_header.checksum == 0x4cbc3b56)return DB_SAVE_TYPE_SRAM; // DMTJ 64DD game
|
||||||
if (rom_header.checksum == 0x0dd4abab)return DB_SAVE_TYPE_EEPROM_16K; // DK Retail kiosk demo (shares ID with Dinosaur planet, but hacks are unlikely)!
|
// if (rom_header.checksum == 0x0dd4abab)return DB_SAVE_TYPE_EEPROM_16K; // DK Retail kiosk demo (shares ID with Dinosaur planet, but hacks are unlikely)!
|
||||||
if (rom_header.checksum == 0xeb85ebc9)return DB_SAVE_TYPE_FLASHRAM; // DOUBUTSU BANCHOU (ANIMAL LEADER, Cubivore) - Contains no game ID
|
// if (rom_header.checksum == 0xeb85ebc9)return DB_SAVE_TYPE_FLASHRAM; // DOUBUTSU BANCHOU (ANIMAL LEADER, Cubivore) - Contains no game ID
|
||||||
|
|
||||||
|
|
||||||
// FIXME: we need to take into account the Category (first char) and the Region code (last char) before a general match of the ID.
|
// FIXME: we need to take into account the Category (first char) and the Region code (last char) before a general match of the ID.
|
||||||
@ -122,8 +122,7 @@ uint8_t rom_db_match_save_type(rom_header_t rom_header) {
|
|||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
// EEP16K
|
// EEP16K
|
||||||
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
||||||
0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef ROM_DATABASE_H__
|
||||||
|
#define ROM_DATABASE_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
// NOTE: these values are independent of flashcart / OS
|
// NOTE: these values are independent of flashcart / OS
|
||||||
@ -75,3 +78,5 @@ typedef struct {
|
|||||||
|
|
||||||
rom_header_t file_read_rom_header(char *path);
|
rom_header_t file_read_rom_header(char *path);
|
||||||
uint8_t rom_db_match_save_type(rom_header_t rom_header);
|
uint8_t rom_db_match_save_type(rom_header_t rom_header);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#define SETTINGS_H__
|
#define SETTINGS_H__
|
||||||
|
|
||||||
#include "flashcart/flashcart.h"
|
#include "flashcart/flashcart.h"
|
||||||
#include "libs/toml/toml.h"
|
|
||||||
#include "boot/boot.h"
|
#include "boot/boot.h"
|
||||||
|
|
||||||
#define SC64_SETTINGS_FILEPATH "sd://config.sc64.toml.txt"
|
#define SC64_SETTINGS_FILEPATH "sd://config.sc64.toml.txt"
|
||||||
|
Loading…
Reference in New Issue
Block a user