parent
11a9f1df21
commit
9efd20d7cd
11
Core/gb.c
11
Core/gb.c
@ -21,7 +21,7 @@
|
|||||||
void GB_attributed_logv(GB_gameboy_t *gb, GB_log_attributes attributes, const char *fmt, va_list args)
|
void GB_attributed_logv(GB_gameboy_t *gb, GB_log_attributes attributes, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
char *string = NULL;
|
char *string = NULL;
|
||||||
(void)vasprintf(&string, fmt, args);
|
vasprintf(&string, fmt, args);
|
||||||
if (string) {
|
if (string) {
|
||||||
if (gb->log_callback) {
|
if (gb->log_callback) {
|
||||||
gb->log_callback(gb, string, attributes);
|
gb->log_callback(gb, string, attributes);
|
||||||
@ -158,12 +158,9 @@ int GB_load_boot_rom(GB_gameboy_t *gb, const char *path)
|
|||||||
GB_log(gb, "Could not open boot ROM: %s.\n", strerror(errno));
|
GB_log(gb, "Could not open boot ROM: %s.\n", strerror(errno));
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
int ret = 0;
|
fread(gb->boot_rom, sizeof(gb->boot_rom), 1, f);
|
||||||
if (fread(gb->boot_rom, sizeof(gb->boot_rom), 1, f) != 1) {
|
|
||||||
ret = -1;
|
|
||||||
}
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GB_load_boot_rom_from_buffer(GB_gameboy_t *gb, const unsigned char *buffer, size_t size)
|
void GB_load_boot_rom_from_buffer(GB_gameboy_t *gb, const unsigned char *buffer, size_t size)
|
||||||
@ -196,7 +193,7 @@ int GB_load_rom(GB_gameboy_t *gb, const char *path)
|
|||||||
}
|
}
|
||||||
gb->rom = malloc(gb->rom_size);
|
gb->rom = malloc(gb->rom_size);
|
||||||
memset(gb->rom, 0xFF, gb->rom_size); /* Pad with 0xFFs */
|
memset(gb->rom, 0xFF, gb->rom_size); /* Pad with 0xFFs */
|
||||||
(void) fread(gb->rom, gb->rom_size, 1, f);
|
fread(gb->rom, gb->rom_size, 1, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
GB_configure_cart(gb);
|
GB_configure_cart(gb);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user