initial port
This commit is contained in:
parent
59d107bfb0
commit
601ce03756
|
@ -0,0 +1,141 @@
|
|||
STATIC_LINKING := 0
|
||||
AR := ar
|
||||
|
||||
ifeq ($(platform),)
|
||||
platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
platform = win
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
platform = osx
|
||||
else ifneq ($(findstring win,$(shell uname -a)),)
|
||||
platform = win
|
||||
endif
|
||||
endif
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
EXE_EXT = .exe
|
||||
system_platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
system_platform = osx
|
||||
arch = intel
|
||||
ifeq ($(shell uname -p),powerpc)
|
||||
arch = ppc
|
||||
endif
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
TARGET_NAME := melonds
|
||||
LIBM = -lm
|
||||
|
||||
ifeq ($(ARCHFLAGS),)
|
||||
ifeq ($(archs),ppc)
|
||||
ARCHFLAGS = -arch ppc -arch ppc64
|
||||
else
|
||||
ARCHFLAGS = -arch i386 -arch x86_64
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(platform), osx)
|
||||
ifndef ($(NOUNIVERSAL))
|
||||
CXXFLAGS += $(ARCHFLAGS)
|
||||
LFLAGS += $(ARCHFLAGS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(STATIC_LINKING), 1)
|
||||
EXT := a
|
||||
endif
|
||||
|
||||
ifeq ($(platform), unix)
|
||||
EXT ?= so
|
||||
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
||||
fpic := -fPIC
|
||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
else ifeq ($(platform), linux-portable)
|
||||
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
||||
fpic := -fPIC -nostdlib
|
||||
SHARED := -shared -Wl,--version-script=link.T
|
||||
LIBM :=
|
||||
else ifneq (,$(findstring osx,$(platform)))
|
||||
TARGET := $(TARGET_NAME)_libretro.dylib
|
||||
fpic := -fPIC
|
||||
SHARED := -dynamiclib
|
||||
else ifneq (,$(findstring ios,$(platform)))
|
||||
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
||||
fpic := -fPIC
|
||||
SHARED := -dynamiclib
|
||||
|
||||
ifeq ($(IOSSDK),)
|
||||
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
|
||||
endif
|
||||
|
||||
DEFINES := -DIOS
|
||||
CC = cc -arch armv7 -isysroot $(IOSSDK)
|
||||
ifeq ($(platform),ios9)
|
||||
CC += -miphoneos-version-min=8.0
|
||||
CXXFLAGS += -miphoneos-version-min=8.0
|
||||
else
|
||||
CC += -miphoneos-version-min=5.0
|
||||
CXXFLAGS += -miphoneos-version-min=5.0
|
||||
endif
|
||||
else ifneq (,$(findstring qnx,$(platform)))
|
||||
TARGET := $(TARGET_NAME)_libretro_qnx.so
|
||||
fpic := -fPIC
|
||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
else ifeq ($(platform), emscripten)
|
||||
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
|
||||
fpic := -fPIC
|
||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
else ifeq ($(platform), vita)
|
||||
TARGET := $(TARGET_NAME)_vita.a
|
||||
CC = arm-vita-eabi-gcc
|
||||
AR = arm-vita-eabi-ar
|
||||
CXXFLAGS += -Wl,-q -Wall -O3
|
||||
STATIC_LINKING = 1
|
||||
else
|
||||
CC = gcc
|
||||
TARGET := $(TARGET_NAME)_libretro.dll
|
||||
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
endif
|
||||
|
||||
LDFLAGS += $(LIBM)
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CXXFLAGS += -O0 -g
|
||||
else
|
||||
CXXFLAGS += -O3
|
||||
endif
|
||||
|
||||
OBJECTS := NDS.o ARM.o ARMInterpreter.o ARMInterpreter_ALU.o ARMInterpreter_Branch.o ARMInterpreter_LoadStore.o CP15.o DMA.o GPU.o GPU2D.o GPU3D.o NDSCart.o RTC.o SPI.o Wifi.o libretro.o
|
||||
CXXFLAGS += -I../../libretro-common/include -Wall -pedantic $(fpic)
|
||||
|
||||
ifneq (,$(findstring qnx,$(platform)))
|
||||
CXXFLAGS += -Wc,-std=c99
|
||||
else
|
||||
CXXFLAGS += -std=gnu99
|
||||
endif
|
||||
|
||||
CXXFLAGS += -I../../libretro-common/include
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
ifeq ($(STATIC_LINKING), 1)
|
||||
$(AR) rcs $@ $(OBJECTS)
|
||||
else
|
||||
$(CXX) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS)
|
||||
endif
|
||||
|
||||
%.o: %.c
|
||||
$(CXX) $(CXXFLAGS) $(fpic) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) $(TARGET)
|
||||
|
||||
.PHONY: clean
|
||||
|
|
@ -0,0 +1,358 @@
|
|||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include "NDS.h"
|
||||
#include "GPU.h"
|
||||
#include "libretro.h"
|
||||
|
||||
static uint32_t *frame_buf;
|
||||
static struct retro_log_callback logging;
|
||||
static retro_log_printf_t log_cb;
|
||||
static bool use_audio_cb;
|
||||
static float last_aspect;
|
||||
static float last_sample_rate;
|
||||
char retro_base_directory[4096];
|
||||
|
||||
static void fallback_log(enum retro_log_level level, const char *fmt, ...)
|
||||
{
|
||||
(void)level;
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
vfprintf(stderr, fmt, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
|
||||
static retro_environment_t environ_cb;
|
||||
|
||||
void retro_init(void)
|
||||
{
|
||||
frame_buf = (uint32_t*)malloc(320 * 240 * sizeof(uint32_t));
|
||||
const char *dir = NULL;
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir)
|
||||
{
|
||||
snprintf(retro_base_directory, sizeof(retro_base_directory), "%s", dir);
|
||||
}
|
||||
|
||||
NDS::Init();
|
||||
}
|
||||
|
||||
void retro_deinit(void)
|
||||
{
|
||||
free(frame_buf);
|
||||
frame_buf = NULL;
|
||||
}
|
||||
|
||||
unsigned retro_api_version(void)
|
||||
{
|
||||
return RETRO_API_VERSION;
|
||||
}
|
||||
|
||||
void retro_set_controller_port_device(unsigned port, unsigned device)
|
||||
{
|
||||
log_cb(RETRO_LOG_INFO, "Plugging device %u into port %u.\n", device, port);
|
||||
}
|
||||
|
||||
void retro_get_system_info(struct retro_system_info *info)
|
||||
{
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->library_name = "melonDS";
|
||||
info->library_version = "what?";
|
||||
info->need_fullpath = true;
|
||||
info->valid_extensions = "nds";
|
||||
}
|
||||
|
||||
static retro_video_refresh_t video_cb;
|
||||
static retro_audio_sample_t audio_cb;
|
||||
static retro_audio_sample_batch_t audio_batch_cb;
|
||||
static retro_input_poll_t input_poll_cb;
|
||||
static retro_input_state_t input_state_cb;
|
||||
|
||||
void retro_get_system_av_info(struct retro_system_av_info *info)
|
||||
{
|
||||
float aspect = 4.0f / 3.0f;
|
||||
float sampling_rate = 30000.0f;
|
||||
|
||||
info->geometry = (struct retro_game_geometry) {
|
||||
.base_width = 320,
|
||||
.base_height = 240,
|
||||
.max_width = 320,
|
||||
.max_height = 240,
|
||||
.aspect_ratio = aspect,
|
||||
};
|
||||
|
||||
last_aspect = aspect;
|
||||
last_sample_rate = sampling_rate;
|
||||
}
|
||||
|
||||
static struct retro_rumble_interface rumble;
|
||||
|
||||
void retro_set_environment(retro_environment_t cb)
|
||||
{
|
||||
environ_cb = cb;
|
||||
|
||||
bool no_content = true;
|
||||
cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &no_content);
|
||||
|
||||
if (cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &logging))
|
||||
log_cb = logging.log;
|
||||
else
|
||||
log_cb = fallback_log;
|
||||
|
||||
static const struct retro_controller_description controllers[] = {
|
||||
{ "Nintendo DS", RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 0) },
|
||||
};
|
||||
|
||||
static const struct retro_controller_info ports[] = {
|
||||
{ controllers, 1 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
|
||||
}
|
||||
|
||||
void retro_set_audio_sample(retro_audio_sample_t cb)
|
||||
{
|
||||
audio_cb = cb;
|
||||
}
|
||||
|
||||
void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb)
|
||||
{
|
||||
audio_batch_cb = cb;
|
||||
}
|
||||
|
||||
void retro_set_input_poll(retro_input_poll_t cb)
|
||||
{
|
||||
input_poll_cb = cb;
|
||||
}
|
||||
|
||||
void retro_set_input_state(retro_input_state_t cb)
|
||||
{
|
||||
input_state_cb = cb;
|
||||
}
|
||||
|
||||
void retro_set_video_refresh(retro_video_refresh_t cb)
|
||||
{
|
||||
video_cb = cb;
|
||||
}
|
||||
|
||||
static unsigned x_coord;
|
||||
static unsigned y_coord;
|
||||
static unsigned phase;
|
||||
static int mouse_rel_x;
|
||||
static int mouse_rel_y;
|
||||
|
||||
void retro_reset(void)
|
||||
{
|
||||
x_coord = 0;
|
||||
y_coord = 0;
|
||||
}
|
||||
|
||||
static void update_input(void)
|
||||
{
|
||||
int dir_x = 0;
|
||||
int dir_y = 0;
|
||||
|
||||
input_poll_cb();
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP))
|
||||
dir_y--;
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN))
|
||||
dir_y++;
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT))
|
||||
dir_x--;
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT))
|
||||
dir_x++;
|
||||
|
||||
if (input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN))
|
||||
log_cb(RETRO_LOG_INFO, "Return key is pressed!\n");
|
||||
|
||||
if (input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_x))
|
||||
log_cb(RETRO_LOG_INFO, "x key is pressed!\n");
|
||||
|
||||
int16_t mouse_x = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X);
|
||||
int16_t mouse_y = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y);
|
||||
bool mouse_l = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT);
|
||||
bool mouse_r = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_RIGHT);
|
||||
bool mouse_down = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_WHEELDOWN);
|
||||
bool mouse_up = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_WHEELUP);
|
||||
bool mouse_middle = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_MIDDLE);
|
||||
if (mouse_x)
|
||||
log_cb(RETRO_LOG_INFO, "Mouse X: %d\n", mouse_x);
|
||||
if (mouse_y)
|
||||
log_cb(RETRO_LOG_INFO, "Mouse Y: %d\n", mouse_y);
|
||||
if (mouse_l)
|
||||
log_cb(RETRO_LOG_INFO, "Mouse L pressed.\n");
|
||||
if (mouse_r)
|
||||
log_cb(RETRO_LOG_INFO, "Mouse R pressed.\n");
|
||||
if (mouse_down)
|
||||
log_cb(RETRO_LOG_INFO, "Mouse wheeldown pressed.\n");
|
||||
if (mouse_up)
|
||||
log_cb(RETRO_LOG_INFO, "Mouse wheelup pressed.\n");
|
||||
if (mouse_middle)
|
||||
log_cb(RETRO_LOG_INFO, "Mouse middle pressed.\n");
|
||||
|
||||
mouse_rel_x += mouse_x;
|
||||
mouse_rel_y += mouse_y;
|
||||
if (mouse_rel_x >= 310)
|
||||
mouse_rel_x = 309;
|
||||
else if (mouse_rel_x < 10)
|
||||
mouse_rel_x = 10;
|
||||
if (mouse_rel_y >= 230)
|
||||
mouse_rel_y = 229;
|
||||
else if (mouse_rel_y < 10)
|
||||
mouse_rel_y = 10;
|
||||
|
||||
bool pointer_pressed = input_state_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_PRESSED);
|
||||
int16_t pointer_x = input_state_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X);
|
||||
int16_t pointer_y = input_state_cb(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y);
|
||||
if (pointer_pressed)
|
||||
log_cb(RETRO_LOG_INFO, "Pointer: (%6d, %6d).\n", pointer_x, pointer_y);
|
||||
|
||||
dir_x += input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X) / 5000;
|
||||
dir_y += input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y) / 5000;
|
||||
dir_x += input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) / 5000;
|
||||
dir_y += input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 5000;
|
||||
|
||||
x_coord = (x_coord + dir_x) & 31;
|
||||
y_coord = (y_coord + dir_y) & 31;
|
||||
|
||||
if (rumble.set_rumble_state)
|
||||
{
|
||||
static bool old_start;
|
||||
static bool old_select;
|
||||
uint16_t strength_strong = input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2) ? 0x4000 : 0xffff;
|
||||
uint16_t strength_weak = input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2) ? 0x4000 : 0xffff;
|
||||
bool start = input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START);
|
||||
bool select = input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT);
|
||||
if (old_start != start)
|
||||
log_cb(RETRO_LOG_INFO, "Strong rumble: %s.\n", start ? "ON": "OFF");
|
||||
rumble.set_rumble_state(0, RETRO_RUMBLE_STRONG, start * strength_strong);
|
||||
|
||||
if (old_select != select)
|
||||
log_cb(RETRO_LOG_INFO, "Weak rumble: %s.\n", select ? "ON": "OFF");
|
||||
rumble.set_rumble_state(0, RETRO_RUMBLE_WEAK, select * strength_weak);
|
||||
|
||||
old_start = start;
|
||||
old_select = select;
|
||||
}
|
||||
}
|
||||
|
||||
static void check_variables(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void audio_callback(void)
|
||||
{
|
||||
for (unsigned i = 0; i < 30000 / 60; i++, phase++)
|
||||
{
|
||||
int16_t val = 0x800 * sinf(2.0f * M_PI * phase * 300.0f / 30000.0f);
|
||||
audio_cb(val, val);
|
||||
}
|
||||
|
||||
phase %= 100;
|
||||
}
|
||||
|
||||
static void audio_set_state(bool enable)
|
||||
{
|
||||
(void)enable;
|
||||
}
|
||||
|
||||
void retro_run(void)
|
||||
{
|
||||
update_input();
|
||||
NDS::RunFrame();
|
||||
if (!use_audio_cb)
|
||||
audio_callback();
|
||||
|
||||
bool updated = false;
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
|
||||
check_variables();
|
||||
}
|
||||
|
||||
bool retro_load_game(const struct retro_game_info *info)
|
||||
{
|
||||
struct retro_input_descriptor desc[] = {
|
||||
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "Left" },
|
||||
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "Up" },
|
||||
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "Down" },
|
||||
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "Right" },
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc);
|
||||
|
||||
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;
|
||||
if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
|
||||
{
|
||||
log_cb(RETRO_LOG_INFO, "XRGB8888 is not supported.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
struct retro_audio_callback audio_cb = { audio_callback, audio_set_state };
|
||||
use_audio_cb = environ_cb(RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK, &audio_cb);
|
||||
|
||||
check_variables();
|
||||
|
||||
(void)info;
|
||||
return true;
|
||||
}
|
||||
|
||||
void retro_unload_game(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
unsigned retro_get_region(void)
|
||||
{
|
||||
return RETRO_REGION_NTSC;
|
||||
}
|
||||
|
||||
bool retro_load_game_special(unsigned type, const struct retro_game_info *info, size_t num)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t retro_serialize_size(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool retro_serialize(void *data_, size_t size)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool retro_unserialize(const void *data_, size_t size)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void *retro_get_memory_data(unsigned id)
|
||||
{
|
||||
(void)id;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t retro_get_memory_size(unsigned id)
|
||||
{
|
||||
(void)id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void retro_cheat_reset(void)
|
||||
{}
|
||||
|
||||
void retro_cheat_set(unsigned index, bool enabled, const char *code)
|
||||
{
|
||||
(void)index;
|
||||
(void)enabled;
|
||||
(void)code;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
11
src/NDS.cpp
11
src/NDS.cpp
|
@ -29,6 +29,7 @@
|
|||
#include "RTC.h"
|
||||
#include "Wifi.h"
|
||||
|
||||
extern char retro_base_directory[4096];
|
||||
|
||||
namespace NDS
|
||||
{
|
||||
|
@ -220,9 +221,11 @@ void Reset()
|
|||
FILE* f;
|
||||
u32 i;
|
||||
|
||||
f = fopen("bios9.bin", "rb");
|
||||
char path[2048];
|
||||
snprintf(path, sizeof(path), "%s/bios9.bin", retro_base_directory);
|
||||
f = fopen(path, "rb");
|
||||
if (!f)
|
||||
printf("ARM9 BIOS not found\n");
|
||||
printf("ARM9 BIOS not found at %s\n");
|
||||
else
|
||||
{
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
@ -232,7 +235,8 @@ void Reset()
|
|||
fclose(f);
|
||||
}
|
||||
|
||||
f = fopen("bios7.bin", "rb");
|
||||
snprintf(path, sizeof(path), "%s/bios7.bin", retro_base_directory);
|
||||
f = fopen(path, "rb");
|
||||
if (!f)
|
||||
printf("ARM7 BIOS not found\n");
|
||||
else
|
||||
|
@ -308,6 +312,7 @@ void Reset()
|
|||
_soundbias = 0;
|
||||
}
|
||||
|
||||
|
||||
void LoadROM(const char* path, bool direct)
|
||||
{
|
||||
Reset();
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "NDS.h"
|
||||
#include "SPI.h"
|
||||
|
||||
extern char retro_base_directory[4096];
|
||||
|
||||
namespace SPI_Firmware
|
||||
{
|
||||
|
@ -37,6 +38,8 @@ u8 StatusReg;
|
|||
u32 Addr;
|
||||
|
||||
|
||||
|
||||
|
||||
u16 CRC16(u8* data, u32 len, u32 start)
|
||||
{
|
||||
u16 blarg[8] = {0xC0C1, 0xC181, 0xC301, 0xC601, 0xCC01, 0xD801, 0xF001, 0xA001};
|
||||
|
@ -85,7 +88,9 @@ void Reset()
|
|||
if (Firmware) delete[] Firmware;
|
||||
Firmware = NULL;
|
||||
|
||||
FILE* f = fopen("firmware.bin", "rb");
|
||||
char path[2047];
|
||||
snprintf(path, sizeof(path), "%s/firmware.bin", retro_base_directory);
|
||||
FILE* f = fopen(path, "rb");
|
||||
if (!f)
|
||||
{
|
||||
printf("firmware.bin not found\n");
|
||||
|
|
Loading…
Reference in New Issue