Merge branch clean-exit-light
This commit is contained in:
commit
9942bfc86e
|
@ -4,7 +4,7 @@
|
|||
#include "rend/TexCache.h"
|
||||
|
||||
extern cResetEvent rs;
|
||||
extern int rend_en;
|
||||
extern int renderer_enabled;
|
||||
extern cResetEvent frame_finished;
|
||||
extern TA_context* rqueue;
|
||||
|
||||
|
@ -33,7 +33,7 @@ void dc_run()
|
|||
double t1 = os_GetSeconds();
|
||||
printf("Loaded context in %g ms\n", (t1- t0) * 1000);
|
||||
|
||||
while(rend_en)
|
||||
while(renderer_enabled)
|
||||
{
|
||||
tad_context saved_tad = ctx->tad;
|
||||
rend_context saved_rend = ctx->rend;
|
||||
|
|
|
@ -76,6 +76,7 @@ u32 VertexCount=0;
|
|||
u32 FrameCount=1;
|
||||
|
||||
Renderer* renderer;
|
||||
bool renderer_enabled = true; // Signals the renderer thread to exit
|
||||
|
||||
#if !defined(TARGET_NO_THREADS)
|
||||
cResetEvent rs(false,true);
|
||||
|
@ -251,6 +252,9 @@ bool rend_single_frame()
|
|||
#if !defined(TARGET_NO_THREADS)
|
||||
rs.Wait();
|
||||
#endif
|
||||
if (!renderer_enabled)
|
||||
return false;
|
||||
|
||||
_pvrrc = DequeueRender();
|
||||
}
|
||||
while (!_pvrrc);
|
||||
|
@ -266,8 +270,6 @@ bool rend_single_frame()
|
|||
return do_swp;
|
||||
}
|
||||
|
||||
int rend_en = true;
|
||||
|
||||
void* rend_thread(void* p)
|
||||
{
|
||||
#if FEAT_HAS_NIXPROF
|
||||
|
@ -308,23 +310,15 @@ void* rend_thread(void* p)
|
|||
//we don't know if this is true, so let's not speculate here
|
||||
//renderer->Resize(640, 480);
|
||||
|
||||
while(rend_en)
|
||||
while (renderer_enabled)
|
||||
{
|
||||
if (rend_single_frame())
|
||||
renderer->Present();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if HOST_OS==OS_LINUX || HOST_OS==OS_DARWIN
|
||||
void rend_terminate()
|
||||
{
|
||||
rend_en = false;
|
||||
printf("rend_terminate called\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(TARGET_NO_THREADS)
|
||||
cThread rthd(rend_thread,0);
|
||||
#endif
|
||||
|
@ -539,11 +533,20 @@ bool rend_init()
|
|||
|
||||
void rend_term()
|
||||
{
|
||||
renderer_enabled = false;
|
||||
#if !defined(TARGET_NO_THREADS)
|
||||
rs.Set();
|
||||
#endif
|
||||
|
||||
if (fCheckFrames)
|
||||
fclose(fCheckFrames);
|
||||
|
||||
if (fLogFrames)
|
||||
fclose(fLogFrames);
|
||||
|
||||
#if !defined(TARGET_NO_THREADS)
|
||||
rthd.WaitToEnd();
|
||||
#endif
|
||||
}
|
||||
|
||||
void rend_vblank()
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
libevdev_func1_t libevdev_event_code_from_name;
|
||||
libevdev_func2_t libevdev_event_code_get_name;
|
||||
|
||||
void dc_stop(void);
|
||||
|
||||
void load_libevdev()
|
||||
{
|
||||
if (libevdev_tried)
|
||||
|
@ -355,8 +357,7 @@
|
|||
} else if (ie.code == controller->mapping->Btn_Start) {
|
||||
SET_FLAG(kcode[port], DC_BTN_START, ie.value);
|
||||
} else if (ie.code == controller->mapping->Btn_Escape) {
|
||||
if (ie.value == 0)
|
||||
start_shutdown();
|
||||
dc_stop();
|
||||
} else if (ie.code == controller->mapping->Btn_DPad_Left) {
|
||||
SET_FLAG(kcode[port], DC_DPAD_LEFT, ie.value);
|
||||
} else if (ie.code == controller->mapping->Btn_DPad_Right) {
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <linux/joystick.h>
|
||||
#include "linux-dist/joystick.h"
|
||||
|
||||
#if defined(USE_JOYSTICK)
|
||||
#include <linux/joystick.h>
|
||||
|
||||
const u32 joystick_map_btn_usb[JOYSTICK_MAP_SIZE] = { DC_BTN_Y, DC_BTN_B, DC_BTN_A, DC_BTN_X, 0, 0, 0, 0, 0, DC_BTN_START };
|
||||
const u32 joystick_map_axis_usb[JOYSTICK_MAP_SIZE] = { DC_AXIS_X, DC_AXIS_Y, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
|
|
|
@ -252,6 +252,7 @@ void os_CreateWindow()
|
|||
void common_linux_setup();
|
||||
int dc_init(int argc,wchar* argv[]);
|
||||
void dc_run();
|
||||
void dc_term();
|
||||
|
||||
#ifdef TARGET_PANDORA
|
||||
void gl_term();
|
||||
|
@ -426,23 +427,6 @@ std::vector<string> find_system_data_dirs()
|
|||
return dirs;
|
||||
}
|
||||
|
||||
#if HOST_OS==OS_LINUX
|
||||
#if defined(SUPPORT_X11)
|
||||
void x11_gl_context_destroy();
|
||||
void x11_window_destroy();
|
||||
#endif
|
||||
void dc_term();
|
||||
void rend_terminate();
|
||||
void ngen_terminate();
|
||||
|
||||
void start_shutdown(void)
|
||||
{
|
||||
printf("start_shutdown called\n");
|
||||
rend_terminate();
|
||||
ngen_terminate();
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, wchar* argv[])
|
||||
{
|
||||
#ifdef TARGET_PANDORA
|
||||
|
@ -491,31 +475,25 @@ int main(int argc, wchar* argv[])
|
|||
emscripten_set_main_loop(&dc_run, 100, false);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TARGET_PANDORA
|
||||
clean_exit(0);
|
||||
#endif
|
||||
|
||||
#if HOST_OS==OS_LINUX
|
||||
dc_term();
|
||||
#if defined(USE_EVDEV)
|
||||
printf("closing any open controllers\n");
|
||||
|
||||
for (int port = 0; port < 4 ; port++)
|
||||
{
|
||||
if(evdev_controllers[port].fd >= 0)
|
||||
#if defined(USE_EVDEV)
|
||||
for (int port = 0; port < 4 ; port++)
|
||||
{
|
||||
close(evdev_controllers[port].fd);
|
||||
if(evdev_controllers[port].fd >= 0)
|
||||
{
|
||||
close(evdev_controllers[port].fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_X11)
|
||||
/* Close the GL context */
|
||||
x11_gl_context_destroy();
|
||||
/* Destroy the window */
|
||||
x11_window_destroy();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORT_X11)
|
||||
x11_window_destroy();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -35,14 +35,16 @@ int x11_width;
|
|||
int x11_height;
|
||||
|
||||
int ndcid = 0;
|
||||
void* x11_glc;
|
||||
void* x11_glc = NULL;
|
||||
bool x11_fullscreen = false;
|
||||
|
||||
void* x11_vis;
|
||||
Atom wmDeleteMessage;
|
||||
|
||||
void* x11_vis;
|
||||
|
||||
extern bool dump_frame_switch;
|
||||
|
||||
void dc_stop(void);
|
||||
|
||||
enum
|
||||
{
|
||||
_NET_WM_STATE_REMOVE =0,
|
||||
|
@ -67,19 +69,17 @@ void x11_window_set_fullscreen(bool fullscreen)
|
|||
XSendEvent((Display*)x11_disp, DefaultRootWindow((Display*)x11_disp), False, SubstructureNotifyMask, &xev);
|
||||
}
|
||||
|
||||
void start_shutdown(void);
|
||||
|
||||
void event_x11_handle()
|
||||
{
|
||||
XEvent event;
|
||||
|
||||
while(XPending((Display *)x11_disp)) {
|
||||
while(XPending((Display *)x11_disp))
|
||||
{
|
||||
XNextEvent((Display *)x11_disp, &event);
|
||||
|
||||
if (event.type == ClientMessage &&
|
||||
event.xclient.data.l[0] == wmDeleteMessage) {
|
||||
start_shutdown();
|
||||
}
|
||||
event.xclient.data.l[0] == wmDeleteMessage)
|
||||
dc_stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ void input_x11_handle()
|
|||
case KeyRelease:
|
||||
if (e.type == KeyRelease && e.xkey.keycode == KEY_ESC)
|
||||
{
|
||||
start_shutdown();
|
||||
dc_stop();
|
||||
}
|
||||
#ifndef RELEASE
|
||||
else if (e.xkey.keycode == KEY_F10)
|
||||
|
@ -269,7 +269,7 @@ void x11_window_create()
|
|||
|
||||
// Get a visual
|
||||
XVisualInfo *vi = glXGetVisualFromFBConfig(x11Display, bestFbc);
|
||||
printf("Chosen visual ID = 0x%x\n", vi->visualid);
|
||||
printf("Chosen visual ID = 0x%lx\n", vi->visualid);
|
||||
|
||||
|
||||
depth = vi->depth;
|
||||
|
@ -308,6 +308,7 @@ void x11_window_create()
|
|||
x11Window = XCreateWindow(x11Display, RootWindow(x11Display, x11Screen), (ndcid%3)*640, (ndcid/3)*480, x11_width, x11_height,
|
||||
0, depth, InputOutput, x11Visual->visual, ui32Mask, &sWA);
|
||||
|
||||
// Capture the close window event
|
||||
wmDeleteMessage = XInternAtom(x11Display, "WM_DELETE_WINDOW", False);
|
||||
XSetWMProtocols(x11Display, x11Window, &wmDeleteMessage, 1);
|
||||
|
||||
|
@ -390,12 +391,18 @@ void x11_window_destroy()
|
|||
if (x11_win)
|
||||
{
|
||||
XDestroyWindow((Display*)x11_disp, (Window)x11_win);
|
||||
x11_win = 0;
|
||||
x11_win = NULL;
|
||||
}
|
||||
if (x11_disp)
|
||||
{
|
||||
if (x11_glc)
|
||||
{
|
||||
glXMakeCurrent((Display*)x11_disp, None, NULL);
|
||||
glXDestroyContext((Display*)x11_disp, (GLXContext)x11_glc);
|
||||
x11_glc = NULL;
|
||||
}
|
||||
XCloseDisplay((Display*)x11_disp);
|
||||
x11_disp = 0;
|
||||
x11_disp = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -4,8 +4,10 @@ extern void* x11_glc;
|
|||
extern void input_x11_init();
|
||||
extern void event_x11_handle();
|
||||
extern void input_x11_handle();
|
||||
extern void event_x11_handle();
|
||||
extern void x11_window_create();
|
||||
extern void x11_window_set_text(const char* text);
|
||||
extern void x11_window_destroy();
|
||||
|
||||
// numbers
|
||||
const int KEY_1 = 10;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <sys/param.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/time.h>
|
||||
#if !defined(_ANDROID) && !defined(TARGET_IPHONE) && !defined(TARGET_NACL32) && !defined(TARGET_EMSCRIPTEN) && !defined(TARGET_OSX) && !defined(TARGET_OSX_X64)
|
||||
#if !defined(TARGET_BSD) && !defined(_ANDROID) && !defined(TARGET_IPHONE) && !defined(TARGET_NACL32) && !defined(TARGET_EMSCRIPTEN) && !defined(TARGET_OSX) && !defined(TARGET_OSX_X64)
|
||||
#include <sys/personality.h>
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
@ -292,7 +292,7 @@ void enable_runfast()
|
|||
}
|
||||
|
||||
void linux_fix_personality() {
|
||||
#if HOST_OS == OS_LINUX && !defined(_ANDROID) && !defined(TARGET_OS_IPHONE) && !defined(TARGET_NACL32) && !defined(TARGET_EMSCRIPTEN)
|
||||
#if !defined(TARGET_BSD) && !defined(_ANDROID) && !defined(TARGET_OS_IPHONE) && !defined(TARGET_NACL32) && !defined(TARGET_EMSCRIPTEN)
|
||||
printf("Personality: %08X\n", personality(0xFFFFFFFF));
|
||||
personality(~READ_IMPLIES_EXEC & personality(0xFFFFFFFF));
|
||||
printf("Updated personality: %08X\n", personality(0xFFFFFFFF));
|
||||
|
@ -300,7 +300,7 @@ void linux_fix_personality() {
|
|||
}
|
||||
|
||||
void linux_rpi2_init() {
|
||||
#if (HOST_OS == OS_LINUX) && !defined(_ANDROID) && !defined(TARGET_NACL32) && !defined(TARGET_EMSCRIPTEN) && defined(TARGET_VIDEOCORE)
|
||||
#if !defined(TARGET_BSD) && !defined(_ANDROID) && !defined(TARGET_NACL32) && !defined(TARGET_EMSCRIPTEN) && defined(TARGET_VIDEOCORE)
|
||||
void* handle;
|
||||
void (*rpi_bcm_init)(void);
|
||||
|
||||
|
|
|
@ -31,7 +31,12 @@ void context_segfault(rei_host_context_t* reictx, void* segfault_ctx, bool to_se
|
|||
|
||||
#if !defined(TARGET_NO_EXCEPTIONS)
|
||||
#if HOST_CPU == CPU_ARM
|
||||
#if HOST_OS == OS_LINUX
|
||||
#if defined(__FreeBSD__)
|
||||
bicopy(reictx->pc, MCTX(.__gregs[_REG_PC]), to_segfault);
|
||||
|
||||
for (int i = 0; i < 15; i++)
|
||||
bicopy(reictx->r[i], MCTX(.__gregs[i]), to_segfault);
|
||||
#elif HOST_OS == OS_LINUX
|
||||
bicopy(reictx->pc, MCTX(.arm_pc), to_segfault);
|
||||
u32* r =(u32*) &MCTX(.arm_r0);
|
||||
|
||||
|
@ -47,7 +52,12 @@ void context_segfault(rei_host_context_t* reictx, void* segfault_ctx, bool to_se
|
|||
#error HOST_OS
|
||||
#endif
|
||||
#elif HOST_CPU == CPU_X86
|
||||
#if HOST_OS == OS_LINUX
|
||||
#if defined(__FreeBSD__)
|
||||
bicopy(reictx->pc, MCTX(.mc_eip), to_segfault);
|
||||
bicopy(reictx->esp, MCTX(.mc_esp), to_segfault);
|
||||
bicopy(reictx->eax, MCTX(.mc_eax), to_segfault);
|
||||
bicopy(reictx->ecx, MCTX(.mc_ecx), to_segfault);
|
||||
#elif HOST_OS == OS_LINUX
|
||||
bicopy(reictx->pc, MCTX(.gregs[REG_EIP]), to_segfault);
|
||||
bicopy(reictx->esp, MCTX(.gregs[REG_ESP]), to_segfault);
|
||||
bicopy(reictx->eax, MCTX(.gregs[REG_EAX]), to_segfault);
|
||||
|
@ -61,11 +71,15 @@ void context_segfault(rei_host_context_t* reictx, void* segfault_ctx, bool to_se
|
|||
#error HOST_OS
|
||||
#endif
|
||||
#elif HOST_CPU == CPU_X64
|
||||
#if HOST_OS == OS_LINUX
|
||||
bicopy(reictx->pc, MCTX(.gregs[REG_RIP]), to_segfault);
|
||||
#elif HOST_OS == OS_DARWIN
|
||||
bicopy(reictx->pc, MCTX(->__ss.__rip), to_segfault);
|
||||
#endif
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
bicopy(reictx->pc, MCTX(.mc_rip), to_segfault);
|
||||
#elif defined(__NetBSD__)
|
||||
bicopy(reictx->pc, MCTX(.__gregs[_REG_RIP]), to_segfault);
|
||||
#elif HOST_OS == OS_LINUX
|
||||
bicopy(reictx->pc, MCTX(.gregs[REG_RIP]), to_segfault);
|
||||
#else
|
||||
#error HOST_OS
|
||||
#endif
|
||||
#elif HOST_CPU == CPU_MIPS
|
||||
bicopy(reictx->pc, MCTX(.pc), to_segfault);
|
||||
#elif HOST_CPU == CPU_GENERIC
|
||||
|
|
|
@ -255,6 +255,13 @@ void dc_term()
|
|||
SaveSettings();
|
||||
#endif
|
||||
SaveRomFiles(get_writable_data_path("/data/"));
|
||||
|
||||
TermAudio();
|
||||
}
|
||||
|
||||
void dc_stop()
|
||||
{
|
||||
sh4_cpu.Stop();
|
||||
}
|
||||
|
||||
void LoadSettings()
|
||||
|
|
|
@ -2,7 +2,11 @@
|
|||
#ifdef USE_OSS
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/fcntl.h>
|
||||
#ifdef TARGET_BSD
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <sys/unistd.h>
|
||||
#endif
|
||||
#include <sys/soundcard.h>
|
||||
|
||||
static int oss_audio_fd = -1;
|
||||
|
|
|
@ -173,14 +173,9 @@ do_iter:
|
|||
HIDDEN(no_update)
|
||||
CSYM(no_update): @ next_pc _MUST_ be on r4 *R4 NOT R0 anymore*
|
||||
|
||||
@ Note: I suspect that the exit thread routine
|
||||
@ below is inefficient. If anyone is familiar
|
||||
@ with asm please consider optimising!
|
||||
|
||||
ldr r3, =CSYM(ngen_required) @ load r3 with the address of c variable ngen_required
|
||||
ldr r0,[r3] @ dereference and store in r0
|
||||
cmp r0,#0 @ compare r0 with numerical value 0
|
||||
beq CSYM(cleanup) @ if compare is true jump to cleanup label and exit thread
|
||||
ldr r0,[r8,#-156] @load CpuRunning
|
||||
cmp r0,#0
|
||||
beq CSYM(cleanup)
|
||||
|
||||
#if DC_PLATFORM == DC_PLATFORM_NAOMI
|
||||
sub r2,r8,#0x4100000
|
||||
|
|
|
@ -2339,18 +2339,4 @@ RuntimeBlockInfo* ngen_AllocateBlock()
|
|||
return new DynaRBI();
|
||||
};
|
||||
|
||||
/* This is declared outside the #if so that any
|
||||
the .s file will still build and run in an infinity
|
||||
loop if ngen_terminate is not available */
|
||||
unsigned int ngen_required = true;
|
||||
|
||||
#if HOST_OS==OS_LINUX
|
||||
|
||||
void ngen_terminate(void)
|
||||
{
|
||||
printf("ngen_terminate called\n");
|
||||
ngen_required = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -46,8 +46,6 @@ void ngen_FailedToFindBlock_internal() {
|
|||
|
||||
void(*ngen_FailedToFindBlock)() = &ngen_FailedToFindBlock_internal;
|
||||
|
||||
unsigned int ngen_required = true;
|
||||
|
||||
void ngen_mainloop(void* v_cntx)
|
||||
{
|
||||
Sh4RCB* ctx = (Sh4RCB*)((u8*)v_cntx - sizeof(Sh4RCB));
|
||||
|
@ -55,7 +53,7 @@ void ngen_mainloop(void* v_cntx)
|
|||
cycle_counter = 0;
|
||||
|
||||
#if !defined(TARGET_BOUNDED_EXECUTION)
|
||||
while (ngen_required) {
|
||||
while (sh4_int_bCpuRun) {
|
||||
#else
|
||||
for (int i=0; i<10000; i++) {
|
||||
#endif
|
||||
|
@ -75,12 +73,6 @@ void ngen_init()
|
|||
{
|
||||
}
|
||||
|
||||
void ngen_terminate(void)
|
||||
{
|
||||
printf("ngen_terminate called\n");
|
||||
ngen_required = false;
|
||||
}
|
||||
|
||||
void ngen_GetFeatures(ngen_features* dst)
|
||||
{
|
||||
dst->InterpreterFallback = false;
|
||||
|
|
|
@ -38,15 +38,13 @@ void ngen_FailedToFindBlock_internal() {
|
|||
|
||||
void(*ngen_FailedToFindBlock)() = &ngen_FailedToFindBlock_internal;
|
||||
|
||||
unsigned int ngen_required = true;
|
||||
|
||||
void ngen_mainloop(void* v_cntx)
|
||||
{
|
||||
Sh4RCB* ctx = (Sh4RCB*)((u8*)v_cntx - sizeof(Sh4RCB));
|
||||
|
||||
cycle_counter = 0;
|
||||
|
||||
do {
|
||||
while (sh4_int_bCpuRun) {
|
||||
cycle_counter = SH4_TIMESLICE;
|
||||
do {
|
||||
DynarecCodeEntryPtr rcb = bm_GetCode(ctx->cntx.pc);
|
||||
|
@ -56,17 +54,9 @@ void ngen_mainloop(void* v_cntx)
|
|||
if (UpdateSystem()) {
|
||||
rdv_DoInterrupts_pc(ctx->cntx.pc);
|
||||
}
|
||||
} while (ngen_required);
|
||||
}
|
||||
}
|
||||
|
||||
#if HOST_OS==OS_LINUX || HOST_OS==OS_DARWIN
|
||||
void ngen_terminate()
|
||||
{
|
||||
ngen_required = false;
|
||||
printf("ngen thread stopped\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
void ngen_init()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -120,8 +120,10 @@ do_iter:
|
|||
pop ecx
|
||||
call rdv_DoInterrupts
|
||||
mov ecx,eax
|
||||
# cmp byte ptr [sh4_int_bCpuRun],0
|
||||
# jz cleanup
|
||||
mov edx,[p_sh4rcb];
|
||||
add edx,[cpurun_offset];
|
||||
cmp dword ptr [edx],0;
|
||||
jz cleanup;
|
||||
jmp no_update
|
||||
|
||||
cleanup:
|
||||
|
|
|
@ -59,6 +59,8 @@ naked void ngen_FailedToFindBlock_()
|
|||
}
|
||||
}
|
||||
|
||||
const u32 cpurun_offset=offsetof(Sh4RCB,cntx.CpuRunning);
|
||||
|
||||
void (*ngen_FailedToFindBlock)()=&ngen_FailedToFindBlock_;
|
||||
naked void ngen_mainloop(void* cntx)
|
||||
{
|
||||
|
@ -93,8 +95,10 @@ do_iter:
|
|||
pop ecx;
|
||||
call rdv_DoInterrupts;
|
||||
mov ecx,eax;
|
||||
// cmp byte ptr [sh4_int_bCpuRun],0;
|
||||
// jz cleanup;
|
||||
mov edx,[p_sh4rcb];
|
||||
add edx,[cpurun_offset];
|
||||
cmp dword ptr [edx],0;
|
||||
jz cleanup;
|
||||
jmp no_update;
|
||||
|
||||
cleanup:
|
||||
|
@ -128,6 +132,7 @@ naked void DYNACALL ngen_blockcheckfail2(u32 addr)
|
|||
}
|
||||
#else
|
||||
u32 gas_offs=offsetof(Sh4RCB,cntx.jdyn);
|
||||
u32 cpurun_offset=offsetof(Sh4RCB,cntx.CpuRunning);
|
||||
void (*ngen_FailedToFindBlock)()=&ngen_FailedToFindBlock_;
|
||||
#endif
|
||||
#endif
|
|
@ -21,7 +21,7 @@ static SDL_GLContext glcontext;
|
|||
static SDL_Joystick* JoySDL = 0;
|
||||
|
||||
extern bool FrameSkipping;
|
||||
extern void dc_term();
|
||||
extern void dc_stop();
|
||||
extern bool KillTex;
|
||||
|
||||
#ifdef TARGET_PANDORA
|
||||
|
@ -374,10 +374,7 @@ void input_sdl_handle(u32 port)
|
|||
if (keys[12]){ kcode[port] &= ~DC_BTN_START; }
|
||||
if (keys[9])
|
||||
{
|
||||
dc_term();
|
||||
|
||||
// is there a proper way to exit? dc_term() doesn't end the dc_run() loop it seems
|
||||
die("death by escape key");
|
||||
dc_stop();
|
||||
}
|
||||
if (keys[10])
|
||||
{
|
||||
|
|
|
@ -102,7 +102,7 @@ PCHAR*
|
|||
return argv;
|
||||
}
|
||||
|
||||
|
||||
void dc_stop(void);
|
||||
|
||||
bool VramLockedWrite(u8* address);
|
||||
bool ngen_Rewrite(unat& addr,unat retadr,unat acc);
|
||||
|
@ -247,6 +247,8 @@ void UpdateInputState(u32 port)
|
|||
|
||||
if (GetAsyncKeyState(VK_F10))
|
||||
DiscSwap();
|
||||
if (GetAsyncKeyState(VK_ESCAPE))
|
||||
dc_stop();
|
||||
}
|
||||
|
||||
void UpdateController(u32 port)
|
||||
|
@ -734,7 +736,7 @@ void os_DoEvents()
|
|||
// If the message is WM_QUIT, exit the while loop
|
||||
if (msg.message == WM_QUIT)
|
||||
{
|
||||
sh4_cpu.Stop();
|
||||
dc_stop();
|
||||
}
|
||||
|
||||
// Translate the message and dispatch it to WindowProc()
|
||||
|
|
|
@ -15,17 +15,15 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
|
||||
|
||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||
// Insert code here to initialize your application
|
||||
emu_main();
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ aNotification: Notification) {
|
||||
emu_shutdown()
|
||||
emu_dc_stop()
|
||||
}
|
||||
|
||||
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,12 @@ class EmuGLView: NSOpenGLView, NSWindowDelegate {
|
|||
self.window!.delegate = self
|
||||
}
|
||||
|
||||
override func viewDidMoveToWindow() {
|
||||
super.viewDidMoveToWindow()
|
||||
self.window!.delegate = self
|
||||
}
|
||||
|
||||
func windowWillClose(_ notification: Notification) {
|
||||
emu_shutdown()
|
||||
emu_dc_stop()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <MacTypes.h>
|
||||
|
||||
void emu_main();
|
||||
void emu_dc_stop();
|
||||
int emu_single_frame(int w, int h);
|
||||
void emu_gles_init();
|
||||
void emu_key_input(UInt16 keyCode, int state);
|
||||
|
|
|
@ -91,6 +91,8 @@ void gl_swap() {
|
|||
void common_linux_setup();
|
||||
int dc_init(int argc,wchar* argv[]);
|
||||
void dc_run();
|
||||
void dc_term();
|
||||
void dc_stop();
|
||||
|
||||
bool has_init = false;
|
||||
void* emuthread(void*) {
|
||||
|
@ -117,9 +119,18 @@ void* emuthread(void*) {
|
|||
|
||||
dc_run();
|
||||
|
||||
has_init = false;
|
||||
|
||||
dc_term();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" void emu_dc_stop()
|
||||
{
|
||||
dc_stop();
|
||||
}
|
||||
|
||||
pthread_t emu_thread;
|
||||
extern "C" void emu_main() {
|
||||
pthread_create(&emu_thread, 0, &emuthread, 0);
|
||||
|
@ -216,14 +227,3 @@ extern "C" void emu_key_input(UInt16 keyCode, int state) {
|
|||
case 0x24: handle_key(Btn_Start, state); break;
|
||||
}
|
||||
}
|
||||
|
||||
void rend_terminate();
|
||||
void ngen_terminate();
|
||||
void dc_term();
|
||||
|
||||
extern "C" void emu_shutdown()
|
||||
{
|
||||
rend_terminate();
|
||||
ngen_terminate();
|
||||
dc_term();
|
||||
}
|
||||
|
|
|
@ -3,11 +3,9 @@ FOR_LINUX :=1
|
|||
#NO_REC := 1
|
||||
#NO_REND := 1
|
||||
WEBUI :=1
|
||||
USE_ALSA := 1
|
||||
USE_OSS := 1
|
||||
#USE_PULSEAUDIO := 1
|
||||
USE_EVDEV := 1
|
||||
USE_JOYSTICK := 1
|
||||
|
||||
CXX=${CC_PREFIX}g++
|
||||
CC=${CC_PREFIX}gcc
|
||||
|
@ -23,6 +21,13 @@ LIBS :=
|
|||
CFLAGS :=
|
||||
CXXFLAGS :=
|
||||
|
||||
ifneq (, $(filter $(shell uname -s), FreeBSD OpenBSD NetBSD DragonFly))
|
||||
CFLAGS += -DTARGET_BSD
|
||||
else
|
||||
USE_ALSA := 1
|
||||
USE_JOYSTICK := 1
|
||||
endif
|
||||
|
||||
# Platform auto-detection
|
||||
# Can be overridden by using:
|
||||
# make platform=x64
|
||||
|
@ -30,7 +35,7 @@ ifeq (,$(platform))
|
|||
ARCH = $(shell uname -m)
|
||||
ifeq ($(ARCH), $(filter $(ARCH), i386 i686))
|
||||
platform = x86
|
||||
else ifeq ($(ARCH), $(filter $(ARCH), x86_64 AMD64))
|
||||
else ifeq ($(ARCH), $(filter $(ARCH), x86_64 AMD64 amd64))
|
||||
platform = x64
|
||||
else ifneq (,$(findstring aarch64,$(ARCH)))
|
||||
HARDWARE = $(shell grep Hardware /proc/cpuinfo)
|
||||
|
@ -92,7 +97,7 @@ ifneq (,$(findstring x86,$(platform)))
|
|||
ASFLAGS += --32
|
||||
LDFLAGS += -m32
|
||||
CFLAGS += -m32 -D TARGET_LINUX_x86 -D TARGET_NO_AREC -fsingle-precision-constant -fno-builtin-sqrtf
|
||||
CXXFLAGS += -fno-exceptions
|
||||
CXXFLAGS += -fexceptions
|
||||
|
||||
ifneq (,$(findstring sse4_1,$(platform)))
|
||||
HAS_SOFTREND := 1
|
||||
|
@ -281,9 +286,9 @@ ifdef USE_DISPMANX
|
|||
endif
|
||||
|
||||
ifdef USE_X11
|
||||
CFLAGS += -D SUPPORT_X11
|
||||
CXXFLAGS += -D SUPPORT_X11
|
||||
LIBS += -lX11
|
||||
CFLAGS += `pkg-config --cflags x11` -D SUPPORT_X11
|
||||
CXXFLAGS += `pkg-config --cflags x11` -D SUPPORT_X11
|
||||
LIBS += `pkg-config --libs x11`
|
||||
endif
|
||||
|
||||
ifdef USE_EVDEV
|
||||
|
@ -300,8 +305,8 @@ ifdef USE_OMX
|
|||
endif
|
||||
|
||||
ifdef USE_ALSA
|
||||
CXXFLAGS += -D USE_ALSA
|
||||
LIBS += -lasound
|
||||
CXXFLAGS += `pkg-config --cflags alsa` -D USE_ALSA
|
||||
LIBS += `pkg-config --libs alsa`
|
||||
endif
|
||||
|
||||
ifdef USE_OSS
|
||||
|
@ -309,8 +314,8 @@ ifdef USE_OSS
|
|||
endif
|
||||
|
||||
ifdef USE_PULSEAUDIO
|
||||
CXXFLAGS += -D USE_PULSEAUDIO
|
||||
LIBS += -lpulse-simple
|
||||
CXXFLAGS += `pkg-config --cflags libpulse-simple` -D USE_PULSEAUDIO
|
||||
LIBS += `pkg-config --libs libpulse-simple`
|
||||
endif
|
||||
|
||||
ifdef HAS_SOFTREND
|
||||
|
@ -393,18 +398,14 @@ $(BUILDDIR)/%.build_obj: $(RZDCY_SRC_DIR)/%.c $(DEPDIR)/%.d
|
|||
$(POSTCOMPILE)
|
||||
|
||||
$(BUILDDIR)/%.build_obj : $(RZDCY_SRC_DIR)/%.S
|
||||
$(BUILDDIR)/%.build_obj: $(RZDCY_SRC_DIR)/%.S $(DEPDIR)/%.d
|
||||
mkdir -p $(dir $@)
|
||||
mkdir -p .dep-$(dir $@)
|
||||
$(AS) $(DEPFLAGS) $(ASFLAGS) $(INCS) $< -o $@
|
||||
$(POSTCOMPILE)
|
||||
$(AS) $(ASFLAGS) $(INCS) $< -o $@
|
||||
|
||||
install: $(EXECUTABLE)
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/share/reicast/mappings 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(MAN_DIR) 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(MENUENTRY_DIR) 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(ICON_DIR) 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin 2>/dev/null || true
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/share/reicast/mappings 2>/dev/null || true
|
||||
mkdir -p $(DESTDIR)$(MAN_DIR) 2>/dev/null || true
|
||||
mkdir -p $(DESTDIR)$(MENUENTRY_DIR) 2>/dev/null || true
|
||||
mkdir -p $(DESTDIR)$(ICON_DIR) 2>/dev/null || true
|
||||
install -m755 $(EXECUTABLE) $(DESTDIR)$(PREFIX)/bin/$(EXECUTABLE_NAME)
|
||||
install -m755 tools/reicast-joyconfig.py $(DESTDIR)$(PREFIX)/bin/reicast-joyconfig
|
||||
install -m644 mappings/controller_gcwz.cfg $(DESTDIR)$(PREFIX)/share/reicast/mappings
|
||||
|
|
|
@ -4,7 +4,7 @@ build:
|
|||
steps:
|
||||
- script:
|
||||
name: install-dependencies
|
||||
code: sudo apt-get clean && sudo apt-get update && sudo apt-get install -y build-essential libasound2-dev libgl1-mesa-dev libx11-dev
|
||||
code: sudo apt-get clean && sudo apt-get update && sudo apt-get install -y build-essential pkgconf libasound2-dev libgl1-mesa-dev libx11-dev
|
||||
- script:
|
||||
name: gcc-version
|
||||
code: gcc --version
|
||||
|
|
Loading…
Reference in New Issue