Small cleanups, added SHA1 hashes

This commit is contained in:
rdanbrook 2018-02-04 17:23:30 -05:00
parent ff4ad90b3b
commit 5e517ad21e
5 changed files with 25 additions and 12 deletions

View file

@ -37,6 +37,7 @@ smsplus: $(OBJ)
$(CC) -o smsplus $(OBJ) $(LIBS) $(LDFLAGS)
obj/%.o: core/%.c core/%.h
@mkdir -p obj/
$(CC) -c $< -o $@ $(FLAGS)
obj/%.o: shell/%.c shell/%.h

View file

@ -69,6 +69,9 @@ int load_rom(char *filename)
cart.pages = (size / 0x4000);
cart.crc = crc32(0L, cart.rom, size);
const char *shabuf = sha1(cart.rom, sizeof(cart.rom));
snprintf(cart.sha1, sizeof(cart.sha1), "%s", shabuf);
/* Assign default settings (US NTSC machine) */
cart.mapper = MAPPER_SEGA;

View file

@ -36,7 +36,7 @@ uint32_t bp_lut[0x20000];
#ifdef ALIGN_DWORD
static __inline__ uint32_t read_dword(void *address)
static inline uint32_t read_dword(void *address)
{
if ((uint32_t)address & 3)
{
@ -57,7 +57,7 @@ static __inline__ uint32_t read_dword(void *address)
}
static __inline__ void write_dword(void *address, uint32_t data)
static inline void write_dword(void *address, uint32_t data)
{
if ((uint32_t)address & 3)
{

View file

@ -3,7 +3,7 @@
#define _SYSTEM_H_
#define APP_NAME "SMS Plus"
#define APP_VERSION "1.8"
#define APP_VERSION "1.9-git"
#define PALETTE_SIZE 0x20
@ -43,6 +43,7 @@ typedef struct
uint8_t *rom;
uint8_t pages;
uint32_t crc;
char sha1[41];
uint32_t sram_crc;
int mapper;
uint8_t sram[0x8000];

View file

@ -245,12 +245,15 @@ static GB_INI_HANDLER(smsp_ini_handler) {
int main (int argc, char *argv[]) {
// Print Header
fprintf(stdout, "%s %s\n", APP_NAME, APP_VERSION);
if(argc < 2) {
fprintf(stderr, "No filename specified.\n");
fprintf(stderr, "Usage: ./smsplus [FILE]\n");
exit(1);
}
snprintf(game_name, sizeof(game_name), "%s", argv[1]);
snprintf(game_name, sizeof(game_name), "%s", argv[1]);
// Load ROM
if(!load_rom(game_name)) {
@ -258,16 +261,21 @@ int main (int argc, char *argv[]) {
exit(1);
}
fprintf(stdout, "CRC : %X\n", cart.crc);
fprintf(stdout, "SHA1: %s\n", cart.sha1);
// Set defaults
settings.video_scale = 2;
settings.audio_rate = settings.audio_rate;
settings.audio_rate = 48000;
settings.audio_fm = 1;
settings.audio_fmtype = SND_EMU2413;
settings.misc_region = TERRITORY_DOMESTIC;
// Override settings set in the .ini
gbIniError err = gb_ini_parse("smsplus.ini", &smsp_ini_handler, &settings);
if (err.type != GB_INI_ERROR_NONE) { return 1; }
if (err.type != GB_INI_ERROR_NONE) {
fprintf(stderr, "Error: No smsplus.ini file found.\n");
}
// Create video buffer
pixels = calloc(VIDEO_WIDTH_SMS * VIDEO_HEIGHT_SMS * 4, 1);
@ -302,9 +310,9 @@ int main (int argc, char *argv[]) {
// Initialize GLFW
if (!glfwInit()) { return -1; }
// Create a windowed mode window and its OpenGL context
window = glfwCreateWindow(VIDEO_WIDTH_SMS * settings.video_scale, VIDEO_HEIGHT_SMS * settings.video_scale, "SMS Plus", NULL, NULL);
window = glfwCreateWindow(VIDEO_WIDTH_SMS * settings.video_scale, VIDEO_HEIGHT_SMS * settings.video_scale, APP_NAME, NULL, NULL);
// If the window can't be created, kill the program
if (!window) {
@ -314,7 +322,7 @@ int main (int argc, char *argv[]) {
// Set up keyboard callback function
glfwSetKeyCallback(window, key_callback);
// Make the window's context current
glfwMakeContextCurrent(window);
@ -350,7 +358,7 @@ int main (int argc, char *argv[]) {
glfwTerminate();
// Shut down
system_poweroff();
system_shutdown();
system_poweroff();
system_shutdown();
return 0;
}