Merge branch 'multisockets'
This commit is contained in:
commit
0521d57963
|
@ -0,0 +1,6 @@
|
|||
[submodule "dynstr/dynstr"]
|
||||
path = dynstr/dynstr
|
||||
url = https://github.com/XaviDCR92/dynstr
|
||||
[submodule "gdbstub/gdbstub"]
|
||||
path = gdbstub/gdbstub
|
||||
url = https://github.com/XaviDCR92/gdbstub
|
|
@ -51,6 +51,5 @@ add_subdirectory(libpcsxcore)
|
|||
add_subdirectory(gui)
|
||||
add_subdirectory(plugins)
|
||||
add_subdirectory(doc)
|
||||
|
||||
|
||||
|
||||
add_subdirectory(dynstr)
|
||||
add_subdirectory(gdbstub)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
message(STATUS "* Configuring dynstr")
|
||||
|
||||
set(SRCS dynstr/dynstr.c)
|
||||
include_directories(dynstr/include)
|
||||
add_library(dynstr STATIC ${SRCS})
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 357d4f2c0fc52ae7e5967f542161d59d09830e27
|
|
@ -0,0 +1,5 @@
|
|||
message(STATUS "* Configuring gdbstub")
|
||||
|
||||
set(SRCS gdbstub/gdbstub.c gdbstub_sys.c)
|
||||
include_directories(gdbstub .)
|
||||
add_library(gdbstub STATIC ${SRCS})
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 8ce6abf8d32291ad66a3724123a9a583b9a3bb4b
|
|
@ -0,0 +1,368 @@
|
|||
#include "gdbstub_sys.h"
|
||||
#include "gdbstub.h"
|
||||
#include "libpcsxcore/socket.h"
|
||||
#include "libpcsxcore/r3000a.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
#include <pthread.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <mqueue.h>
|
||||
#include <errno.h>
|
||||
|
||||
static pthread_t thread;
|
||||
static mqd_t in_queue, out_queue;
|
||||
#endif
|
||||
|
||||
static int server_socket, client_socket;
|
||||
static enum {
|
||||
PAUSED,
|
||||
} state;
|
||||
|
||||
static void update_regs(struct dbg_state *const dbg_state)
|
||||
{
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_ZERO] = 0;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_AT] = psxRegs.GPR.n.at;
|
||||
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_V0] = psxRegs.GPR.n.v0;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_V1] = psxRegs.GPR.n.v1;
|
||||
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_A0] = psxRegs.GPR.n.a0;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_A1] = psxRegs.GPR.n.a1;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_A2] = psxRegs.GPR.n.a2;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_A3] = psxRegs.GPR.n.a3;
|
||||
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_T0] = psxRegs.GPR.n.t0;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_T1] = psxRegs.GPR.n.t1;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_T2] = psxRegs.GPR.n.t2;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_T3] = psxRegs.GPR.n.t3;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_T4] = psxRegs.GPR.n.t4;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_T5] = psxRegs.GPR.n.t5;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_T6] = psxRegs.GPR.n.t6;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_T7] = psxRegs.GPR.n.t7;
|
||||
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_S0] = psxRegs.GPR.n.s0;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_S1] = psxRegs.GPR.n.s1;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_S2] = psxRegs.GPR.n.s2;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_S3] = psxRegs.GPR.n.s3;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_S4] = psxRegs.GPR.n.s4;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_S5] = psxRegs.GPR.n.s5;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_S6] = psxRegs.GPR.n.s6;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_S7] = psxRegs.GPR.n.s7;
|
||||
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_T8] = psxRegs.GPR.n.t8;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_T9] = psxRegs.GPR.n.t9;
|
||||
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_K0] = psxRegs.GPR.n.k0;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_K1] = psxRegs.GPR.n.k1;
|
||||
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_GP] = psxRegs.GPR.n.gp;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_SP] = psxRegs.GPR.n.sp;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_S8] = psxRegs.GPR.n.s8;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_RA] = psxRegs.GPR.n.ra;
|
||||
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_SR] = psxRegs.CP0.n.Status;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_LO] = psxRegs.GPR.r[32];
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_HI] = psxRegs.GPR.r[33];
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_BAD] = psxRegs.CP0.n.BadVAddr;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_CAUSE] = psxRegs.CP0.n.Cause;
|
||||
dbg_state->registers[DBG_CPU_MIPS_I_REG_PC] = psxRegs.pc;
|
||||
}
|
||||
|
||||
int dbg_sys_getc(void)
|
||||
{
|
||||
while (1) {
|
||||
char packet;
|
||||
size_t len = sizeof packet;
|
||||
const enum read_socket_err err = ReadSocket(client_socket, &packet, &len);
|
||||
|
||||
switch (err) {
|
||||
case READ_SOCKET_OK:
|
||||
return packet;
|
||||
|
||||
case READ_SOCKET_SHUTDOWN: {
|
||||
struct msg msg;
|
||||
|
||||
printf("gdb shutdown\n");
|
||||
client_socket = 0;
|
||||
msg.type = MSG_TYPE_SHUTDOWN;
|
||||
|
||||
if (mq_send(out_queue, (const char *)&msg, sizeof msg, 0))
|
||||
perror("dbg_sys_getc() mq_send()");
|
||||
return EOF;
|
||||
}
|
||||
|
||||
case READ_SOCKET_ERR_INVALID_ARG:
|
||||
/* Fall through. */
|
||||
case READ_SOCKET_ERR_RECV:
|
||||
/* Fall through. */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int dbg_sys_putchar(int ch)
|
||||
{
|
||||
WriteSocket(client_socket, (const char *)&ch, sizeof (char));
|
||||
}
|
||||
|
||||
int dbg_sys_mem_readb(address addr, char *val)
|
||||
{
|
||||
*val = psxMemRead8(addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dbg_sys_mem_writeb(address addr, char val)
|
||||
{
|
||||
psxMemWrite8(addr, val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
static int wait_hit_or_break(struct msg *msg)
|
||||
{
|
||||
do {
|
||||
int ret = mq_receive(in_queue, (char *)msg, sizeof *msg, 0);
|
||||
|
||||
if (ret < 0 && errno == EAGAIN) {
|
||||
/* Breakpoint has not been hit yet, look for incoming messages from gdb. */
|
||||
char packet;
|
||||
size_t len = sizeof packet;
|
||||
const enum read_socket_err err = ReadSocket(client_socket, &packet, &len);
|
||||
|
||||
switch (err) {
|
||||
case READ_SOCKET_OK:
|
||||
if (len && packet == 0x03)
|
||||
return 0;
|
||||
|
||||
break;
|
||||
|
||||
case READ_SOCKET_SHUTDOWN:
|
||||
printf("gdb shutdown\n");
|
||||
client_socket = 0;
|
||||
msg->type = MSG_TYPE_SHUTDOWN;
|
||||
|
||||
if (mq_send(out_queue, (const char *)msg, sizeof *msg, 0))
|
||||
perror("wait_hit_or_break() mq_send()");
|
||||
|
||||
return EOF;
|
||||
|
||||
case READ_SOCKET_ERR_INVALID_ARG:
|
||||
/* Fall through. */
|
||||
case READ_SOCKET_ERR_RECV:
|
||||
/* Fall through. */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (msg->type != MSG_TYPE_HIT) {
|
||||
fprintf(stderr, "unexpected msg.type %d\n", msg->type);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
} while (1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
int dbg_sys_continue(void)
|
||||
{
|
||||
struct msg msg;
|
||||
|
||||
msg.type = MSG_TYPE_CONTINUE;
|
||||
|
||||
if (mq_send(out_queue, (const char *)&msg, sizeof msg, 0)) {
|
||||
perror("dbg_sys_continue(): mq_send()");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return wait_hit_or_break(&msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
int dbg_sys_step(void)
|
||||
{
|
||||
struct msg msg;
|
||||
|
||||
msg.type = MSG_TYPE_STEP;
|
||||
|
||||
if (mq_send(out_queue, (const char *)&msg, sizeof msg, 0)) {
|
||||
perror("dbg_sys_step(): mq_send()");
|
||||
}
|
||||
|
||||
return wait_hit_or_break(&msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
static int wait_ack(struct msg *msg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
do {
|
||||
ret = mq_receive(in_queue, (char *)msg, sizeof *msg, 0);
|
||||
} while (ret < 0 && errno == EAGAIN);
|
||||
|
||||
if (msg->type != MSG_TYPE_ACK) {
|
||||
fprintf(stderr, "unexpected msg.type %d\n", msg->type);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
int dbg_sys_breakpoint(address addr)
|
||||
{
|
||||
struct msg msg;
|
||||
|
||||
msg.type = MSG_TYPE_BREAKPOINT;
|
||||
msg.data.breakpoint.addr = addr;
|
||||
|
||||
if (mq_send(out_queue, (const char *)&msg, sizeof msg, 0)) {
|
||||
perror("dbg_sys_breakpoint(): mq_send()");
|
||||
}
|
||||
|
||||
return wait_ack(&msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
int dbg_sys_del_breakpoint(address addr)
|
||||
{
|
||||
struct msg msg;
|
||||
|
||||
msg.type = MSG_TYPE_REMOVE_BREAKPOINT;
|
||||
|
||||
if (mq_send(out_queue, (const char *)&msg, sizeof msg, 0)) {
|
||||
perror("dbg_sys_breakpoint(): mq_send()");
|
||||
}
|
||||
|
||||
return wait_ack(&msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
static int queue_create(void)
|
||||
{
|
||||
struct mq_attr attr;
|
||||
|
||||
attr.mq_msgsize = sizeof (struct msg);
|
||||
attr.mq_flags = 0;
|
||||
attr.mq_maxmsg = 4;
|
||||
|
||||
mq_unlink("/pcsxrin");
|
||||
in_queue = mq_open("/pcsxrin", O_CREAT | O_RDWR | O_EXCL | O_NONBLOCK, 0600, &attr);
|
||||
|
||||
mq_unlink("/pcsxrout");
|
||||
out_queue = mq_open("/pcsxrout", O_CREAT | O_RDWR | O_EXCL, 0600, &attr);
|
||||
|
||||
if ((out_queue < 0) || (in_queue < 0)) {
|
||||
perror("mq_open()");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int exit_loop;
|
||||
|
||||
static void *loop(void *const args)
|
||||
{
|
||||
struct dbg_state dbg_state = {0};
|
||||
|
||||
SetsBlock(server_socket);
|
||||
|
||||
if ((client_socket = GetClient(server_socket, 1)) < 0) {
|
||||
fprintf(stderr, "GetClient() failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SetsNonblock(client_socket);
|
||||
|
||||
printf("Accepted gdb connection\n");
|
||||
|
||||
while (!exit_loop) {
|
||||
update_regs(&dbg_state);
|
||||
dbg_main(&dbg_state);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
static void start_thread(void)
|
||||
{
|
||||
if (pthread_create(&thread, NULL, loop, NULL))
|
||||
perror("could not start gdb server thread");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
static void stop_thread(void)
|
||||
{
|
||||
if (pthread_join(thread, NULL))
|
||||
perror("pthread_join()");
|
||||
|
||||
mq_unlink("/pcsxrin");
|
||||
mq_unlink("/pcsxrout");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
void gdbstub_sys_recv(struct msg *msg)
|
||||
{
|
||||
const ssize_t sz = mq_receive(out_queue, (char *)msg, sizeof *msg, 0);
|
||||
|
||||
if (sz < 0)
|
||||
perror("mq_receive");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
void gdbstub_sys_send(const struct msg *msg)
|
||||
{
|
||||
if (mq_send(in_queue, (const char *)msg, sizeof *msg, 0)) {
|
||||
perror("dbg_sys_send(): mq_send()");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void dbg_stop(void)
|
||||
{
|
||||
exit_loop = 1;
|
||||
stop_thread();
|
||||
}
|
||||
|
||||
void dbg_start(void)
|
||||
{
|
||||
if (server_socket > 0) {
|
||||
fprintf(stderr, "gdb server already started\n");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
const unsigned short port = 3333;
|
||||
|
||||
server_socket = StartServer(port);
|
||||
|
||||
if (server_socket > 0) {
|
||||
printf("GDB server started on port %hu.\n", port);
|
||||
if (queue_create())
|
||||
fprintf(stderr, "could not create gdb stub internal queues\n");
|
||||
else
|
||||
start_thread();
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "could not start GDB server\n");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
#ifndef GDBSTUB_SYS_H
|
||||
#define GDBSTUB_SYS_H
|
||||
|
||||
typedef unsigned int address;
|
||||
|
||||
enum DBG_REGISTER {
|
||||
DBG_CPU_MIPS_I_REG_ZERO,
|
||||
DBG_CPU_MIPS_I_REG_AT,
|
||||
DBG_CPU_MIPS_I_REG_V0,
|
||||
DBG_CPU_MIPS_I_REG_V1,
|
||||
DBG_CPU_MIPS_I_REG_A0,
|
||||
DBG_CPU_MIPS_I_REG_A1,
|
||||
DBG_CPU_MIPS_I_REG_A2,
|
||||
DBG_CPU_MIPS_I_REG_A3,
|
||||
DBG_CPU_MIPS_I_REG_T0,
|
||||
DBG_CPU_MIPS_I_REG_T1,
|
||||
DBG_CPU_MIPS_I_REG_T2,
|
||||
DBG_CPU_MIPS_I_REG_T3,
|
||||
DBG_CPU_MIPS_I_REG_T4,
|
||||
DBG_CPU_MIPS_I_REG_T5,
|
||||
DBG_CPU_MIPS_I_REG_T6,
|
||||
DBG_CPU_MIPS_I_REG_T7,
|
||||
DBG_CPU_MIPS_I_REG_S0,
|
||||
DBG_CPU_MIPS_I_REG_S1,
|
||||
DBG_CPU_MIPS_I_REG_S2,
|
||||
DBG_CPU_MIPS_I_REG_S3,
|
||||
DBG_CPU_MIPS_I_REG_S4,
|
||||
DBG_CPU_MIPS_I_REG_S5,
|
||||
DBG_CPU_MIPS_I_REG_S6,
|
||||
DBG_CPU_MIPS_I_REG_S7,
|
||||
DBG_CPU_MIPS_I_REG_T8,
|
||||
DBG_CPU_MIPS_I_REG_T9,
|
||||
DBG_CPU_MIPS_I_REG_K0,
|
||||
DBG_CPU_MIPS_I_REG_K1,
|
||||
DBG_CPU_MIPS_I_REG_GP,
|
||||
DBG_CPU_MIPS_I_REG_SP,
|
||||
DBG_CPU_MIPS_I_REG_S8,
|
||||
DBG_CPU_MIPS_I_REG_RA,
|
||||
DBG_CPU_MIPS_I_REG_SR,
|
||||
DBG_CPU_MIPS_I_REG_LO,
|
||||
DBG_CPU_MIPS_I_REG_HI,
|
||||
DBG_CPU_MIPS_I_REG_BAD,
|
||||
DBG_CPU_MIPS_I_REG_CAUSE,
|
||||
DBG_CPU_MIPS_I_REG_PC,
|
||||
|
||||
/* GDB requests 73, where 38 are the ones above and the rest
|
||||
* are the floating-point registers. This way, unused registers
|
||||
* are left to zero. */
|
||||
DBG_CPU_NUM_REGISTERS = 73
|
||||
};
|
||||
|
||||
typedef unsigned int reg;
|
||||
|
||||
struct dbg_state {
|
||||
int signum;
|
||||
reg registers[DBG_CPU_NUM_REGISTERS];
|
||||
};
|
||||
|
||||
struct msg {
|
||||
enum {
|
||||
MSG_TYPE_CONTINUE,
|
||||
MSG_TYPE_BREAKPOINT,
|
||||
MSG_TYPE_STEP,
|
||||
MSG_TYPE_ACK,
|
||||
MSG_TYPE_REMOVE_BREAKPOINT,
|
||||
MSG_TYPE_SHUTDOWN,
|
||||
|
||||
/* Response frames. */
|
||||
MSG_TYPE_HIT
|
||||
} type;
|
||||
|
||||
union {
|
||||
struct {
|
||||
address addr;
|
||||
} breakpoint;
|
||||
} data;
|
||||
};
|
||||
|
||||
void dbg_start(void);
|
||||
void dbg_stop(void);
|
||||
void gdbstub_sys_send(const struct msg *msg);
|
||||
void gdbstub_sys_recv(struct msg *msg);
|
||||
|
||||
#endif /* GDBSTUB_SYS_H */
|
|
@ -32,6 +32,7 @@
|
|||
#include "ConfDlg.h"
|
||||
|
||||
#include "../libpcsxcore/plugins.h"
|
||||
#include "../gdbstub/gdbstub_sys.h"
|
||||
|
||||
static void OnBiosPath_Changed(GtkWidget *wdg, gpointer data);
|
||||
static void OnConf_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data);
|
||||
|
@ -109,7 +110,7 @@ void ConfigurePlugins() {
|
|||
UpdatePluginsBIOS_UpdateGUI(builder);
|
||||
|
||||
ConfDlg = GTK_WIDGET(gtk_builder_get_object(builder, "ConfDlg"));
|
||||
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(ConfDlg), _("Configure PCSXR"));
|
||||
gtk_widget_show (ConfDlg);
|
||||
|
||||
|
@ -219,7 +220,7 @@ void OnConf_Net() {
|
|||
}
|
||||
|
||||
NetDlg = GTK_WIDGET(gtk_builder_get_object(builder, "NetDlg"));
|
||||
|
||||
|
||||
gtk_widget_show (NetDlg);
|
||||
|
||||
FindNetPlugin(builder);
|
||||
|
@ -791,7 +792,7 @@ static void FindNetPlugin() {
|
|||
char plugin[MAXPATHLEN],name[MAXPATHLEN];
|
||||
|
||||
NetConfS.plugins = 0;
|
||||
NetConfS.glist = NULL;
|
||||
NetConfS.glist = NULL;
|
||||
|
||||
NetConfS.plugins += 2;
|
||||
strcpy(NetConfS.plist[NetConfS.plugins - 1], "Disabled");
|
||||
|
@ -894,7 +895,7 @@ void OnCpu_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) {
|
|||
|
||||
// If nothing chosen, default to NTSC
|
||||
tmp = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
|
||||
if (tmp == -1)
|
||||
if (tmp == -1)
|
||||
tmp = PSX_TYPE_NTSC;
|
||||
|
||||
if (!strcmp("NTSC", psxtypes[tmp]))
|
||||
|
@ -920,6 +921,7 @@ void OnCpu_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) {
|
|||
Config.Cdda = gtk_combo_box_get_active(GTK_COMBO_BOX(gtk_builder_get_object(builder, "GtkCombo_CDDA")));
|
||||
Config.SlowBoot = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_SlowBoot")));
|
||||
Config.PsxAuto = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_PsxAuto")));
|
||||
Config.GdbServer = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_GdbServer")));
|
||||
|
||||
t = Config.Debug;
|
||||
Config.Debug = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Dbg")));
|
||||
|
@ -928,6 +930,9 @@ void OnCpu_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) {
|
|||
else StopDebugger();
|
||||
}
|
||||
|
||||
if (Config.GdbServer)
|
||||
dbg_start();
|
||||
|
||||
t = Config.Cpu;
|
||||
Config.Cpu = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Cpu")));
|
||||
if (t != Config.Cpu) {
|
||||
|
@ -974,7 +979,7 @@ void OnConf_Cpu() {
|
|||
char buf[25];
|
||||
|
||||
builder = gtk_builder_new();
|
||||
|
||||
|
||||
if (!gtk_builder_add_from_resource(builder, "/org/pcsxr/gui/pcsxr.ui", NULL)) {
|
||||
g_warning("Error: interface could not be loaded!");
|
||||
return;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include "../libpcsxcore/sio.h"
|
||||
#include "../gdbstub/gdbstub_sys.h"
|
||||
|
||||
#include "Linux.h"
|
||||
#include "ConfDlg.h"
|
||||
|
@ -320,6 +321,11 @@ int main(int argc, char *argv[]) {
|
|||
SetIsoFile(isofilename);
|
||||
runcd = RUN_CD;
|
||||
}
|
||||
else if (!strcmp(argv[i], "-gdb")) {
|
||||
/* Force configuration. */
|
||||
Config.Cpu = CPU_INTERPRETER;
|
||||
Config.GdbServer = 1;
|
||||
}
|
||||
else if (!strcmp(argv[i], "-h") ||
|
||||
!strcmp(argv[i], "-help") ||
|
||||
!strcmp(argv[i], "--help")) {
|
||||
|
@ -443,7 +449,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (loadst==0) {
|
||||
loadst = UpdateMenuSlots() + 1;
|
||||
}
|
||||
|
@ -460,6 +466,8 @@ int main(int argc, char *argv[]) {
|
|||
psxCpu->Execute();
|
||||
}
|
||||
|
||||
if (Config.GdbServer) dbg_stop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -490,9 +498,10 @@ int SysInit() {
|
|||
|
||||
LoadMcds(Config.Mcd1, Config.Mcd2); /* TODO Do we need to have this here, or in the calling main() function?? */
|
||||
|
||||
if (Config.Debug) {
|
||||
if (Config.Debug)
|
||||
StartDebugger();
|
||||
}
|
||||
else if (Config.GdbServer)
|
||||
dbg_start();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.20.0 -->
|
||||
<!-- Generated with glade 3.22.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.14"/>
|
||||
<object class="GtkAboutDialog" id="AboutDlg">
|
||||
|
@ -10,6 +10,9 @@
|
|||
<property name="type_hint">dialog</property>
|
||||
<property name="program_name">pcsxr</property>
|
||||
<property name="logo_icon_name">image-missing</property>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="aboutdialog-vbox1">
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -32,9 +35,6 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkDialog" id="CheatListDlg">
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -43,6 +43,9 @@
|
|||
<property name="modal">True</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox7">
|
||||
<property name="visible">True</property>
|
||||
|
@ -217,9 +220,6 @@
|
|||
<action-widgets>
|
||||
<action-widget response="0">closbutton1</action-widget>
|
||||
</action-widgets>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkDialog" id="ConfDlg">
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -228,6 +228,9 @@
|
|||
<property name="modal">True</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox4">
|
||||
<property name="visible">True</property>
|
||||
|
@ -916,9 +919,6 @@
|
|||
<action-widgets>
|
||||
<action-widget response="-6">btn_ConfClose</action-widget>
|
||||
</action-widgets>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkDialog" id="McdsDlg">
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -928,6 +928,9 @@
|
|||
<property name="default_width">688</property>
|
||||
<property name="default_height">400</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox3">
|
||||
<property name="visible">True</property>
|
||||
|
@ -1750,9 +1753,6 @@
|
|||
<action-widgets>
|
||||
<action-widget response="-5">McdClose</action-widget>
|
||||
</action-widgets>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkDialog" id="MemViewDlg">
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -1762,6 +1762,9 @@
|
|||
<property name="modal">True</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox9">
|
||||
<property name="visible">True</property>
|
||||
|
@ -2032,9 +2035,6 @@
|
|||
<action-widgets>
|
||||
<action-widget response="0">memview_close</action-widget>
|
||||
</action-widgets>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkDialog" id="NetDlg">
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -2044,6 +2044,9 @@
|
|||
<property name="window_position">center-on-parent</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<signal name="destroy" handler="OnNet_Cancel" swapped="no"/>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox2">
|
||||
<property name="visible">True</property>
|
||||
|
@ -2191,9 +2194,6 @@
|
|||
<action-widgets>
|
||||
<action-widget response="-6">closebutton2</action-widget>
|
||||
</action-widgets>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkListStore" id="PGXP_Mode_list">
|
||||
<columns>
|
||||
|
@ -2219,6 +2219,9 @@
|
|||
<property name="modal">True</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox">
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -2454,9 +2457,6 @@
|
|||
<action-widgets>
|
||||
<action-widget response="0">PgxpDlg_close</action-widget>
|
||||
</action-widgets>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment_PsxClock">
|
||||
<property name="lower">0.5</property>
|
||||
|
@ -2638,6 +2638,9 @@
|
|||
<property name="resizable">False</property>
|
||||
<property name="icon_name">pcsxr-icon.png</property>
|
||||
<signal name="destroy" handler="OnDestroy" swapped="no"/>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="vbox18">
|
||||
<property name="visible">True</property>
|
||||
|
@ -3444,9 +3447,6 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
|
@ -3536,6 +3536,9 @@
|
|||
<property name="modal">True</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox8">
|
||||
<property name="visible">True</property>
|
||||
|
@ -4055,9 +4058,6 @@
|
|||
<action-widgets>
|
||||
<action-widget response="0">closebutton</action-widget>
|
||||
</action-widgets>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkListStore" id="liststore5">
|
||||
<columns>
|
||||
|
@ -4083,6 +4083,9 @@
|
|||
<property name="modal">True</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
|
@ -4143,8 +4146,8 @@
|
|||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -4158,7 +4161,7 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -4171,8 +4174,8 @@
|
|||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -4200,7 +4203,7 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -4214,7 +4217,7 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -4227,8 +4230,8 @@
|
|||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -4241,8 +4244,8 @@
|
|||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -4255,8 +4258,8 @@
|
|||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -4269,8 +4272,8 @@
|
|||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">10</property>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -4284,7 +4287,7 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">11</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -4297,8 +4300,8 @@
|
|||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">12</property>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -4312,11 +4315,22 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">13</property>
|
||||
<property name="top_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkCheckButton" id="GtkCheckButton_GdbServer">
|
||||
<property name="label" translatable="yes">Enable GDB server</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
@ -4810,8 +4824,5 @@
|
|||
<action-widgets>
|
||||
<action-widget response="-6">closebutton1</action-widget>
|
||||
</action-widgets>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -6,6 +6,8 @@ set_property(CACHE DYNAREC PROPERTY STRINGS auto x86_64 x86 ppc no)
|
|||
option(ENABLE_CCDDA "Enables compressed CDDA support." OFF)
|
||||
option(USE_LIBARCHIVE "Enables compressed data-tracks support." OFF)
|
||||
|
||||
include_directories(../dynstr/dynstr/include)
|
||||
|
||||
if (ENABLE_CCDDA)
|
||||
find_package(FFMPEG REQUIRED)
|
||||
include_directories(${FFMPEG_INCLUDE_DIRS})
|
||||
|
@ -114,4 +116,4 @@ endif()
|
|||
set(SRCS ${SRCS} ${DYNAREC_SRC})
|
||||
|
||||
add_library(pcsxcore STATIC ${SRCS})
|
||||
target_link_libraries(pcsxcore ${FFMPEG_LIBRARIES} ${LibArchive_LIBRARIES} ${LIBS})
|
||||
target_link_libraries(pcsxcore dynstr gdbstub ${FFMPEG_LIBRARIES} ${LibArchive_LIBRARIES} ${LIBS})
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -46,7 +46,7 @@ extern char *disRNameCP0[];
|
|||
|
||||
char* disR3000AF(u32 code, u32 pc);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Specficies which logs should be activated.
|
||||
*/
|
||||
|
||||
|
|
|
@ -14,12 +14,12 @@ PGXP_value* CPU_reg = CPU_reg_mem;
|
|||
PGXP_value* CP0_reg = CP0_reg_mem;
|
||||
|
||||
// Instruction register decoding
|
||||
#define op(_instr) (_instr >> 26) // The op part of the instruction register
|
||||
#define func(_instr) ((_instr) & 0x3F) // The funct part of the instruction register
|
||||
#define op(_instr) (_instr >> 26) // The op part of the instruction register
|
||||
#define func(_instr) ((_instr) & 0x3F) // The funct part of the instruction register
|
||||
#define sa(_instr) ((_instr >> 6) & 0x1F) // The sa part of the instruction register
|
||||
#define rd(_instr) ((_instr >> 11) & 0x1F) // The rd part of the instruction register
|
||||
#define rt(_instr) ((_instr >> 16) & 0x1F) // The rt part of the instruction register
|
||||
#define rs(_instr) ((_instr >> 21) & 0x1F) // The rs part of the instruction register
|
||||
#define rd(_instr) ((_instr >> 11) & 0x1F) // The rd part of the instruction register
|
||||
#define rt(_instr) ((_instr >> 16) & 0x1F) // The rt part of the instruction register
|
||||
#define rs(_instr) ((_instr >> 21) & 0x1F) // The rs part of the instruction register
|
||||
#define imm(_instr) (_instr & 0xFFFF) // The immediate part of the instruction register
|
||||
|
||||
void PGXP_InitCPU()
|
||||
|
@ -31,7 +31,7 @@ void PGXP_InitCPU()
|
|||
// invalidate register (invalid 8 bit read)
|
||||
void InvalidLoad(u32 addr, u32 code, u32 value)
|
||||
{
|
||||
u32 reg = ((code >> 16) & 0x1F); // The rt part of the instruction register
|
||||
u32 reg = ((code >> 16) & 0x1F); // The rt part of the instruction register
|
||||
PGXP_value* pD = NULL;
|
||||
PGXP_value p;
|
||||
|
||||
|
@ -60,7 +60,7 @@ void InvalidLoad(u32 addr, u32 code, u32 value)
|
|||
// invalidate memory address (invalid 8 bit write)
|
||||
void InvalidStore(u32 addr, u32 code, u32 value)
|
||||
{
|
||||
u32 reg = ((code >> 16) & 0x1F); // The rt part of the instruction register
|
||||
u32 reg = ((code >> 16) & 0x1F); // The rt part of the instruction register
|
||||
PGXP_value* pD = NULL;
|
||||
PGXP_value p;
|
||||
|
||||
|
@ -86,7 +86,7 @@ void PGXP_CPU_ADDI(u32 instr, u32 rtVal, u32 rsVal)
|
|||
// Rt = Rs + Imm (signed)
|
||||
psx_value tempImm;
|
||||
PGXP_value ret;
|
||||
|
||||
|
||||
Validate(&CPU_reg[rs(instr)], rsVal);
|
||||
ret = CPU_reg[rs(instr)];
|
||||
tempImm.d = imm(instr);
|
||||
|
@ -674,11 +674,11 @@ void PGXP_CPU_SLL(u32 instr, u32 rdVal, u32 rtVal)
|
|||
PGXP_value ret;
|
||||
u32 sh = sa(instr);
|
||||
Validate(&CPU_reg[rt(instr)], rtVal);
|
||||
|
||||
|
||||
ret = CPU_reg[rt(instr)];
|
||||
|
||||
// TODO: Shift flags
|
||||
#if 1
|
||||
#if 1
|
||||
double x = f16Unsign(CPU_reg[rt(instr)].x);
|
||||
double y = f16Unsign(CPU_reg[rt(instr)].y);
|
||||
if (sh >= 32)
|
||||
|
@ -797,7 +797,7 @@ void PGXP_CPU_SRL(u32 instr, u32 rdVal, u32 rtVal)
|
|||
else if ((valt.w.h & mask) == 0)
|
||||
x = x;
|
||||
else
|
||||
x += y * (1 << (16 - sh));//f16Overflow(y);
|
||||
x += y * (1 << (16 - sh));//f16Overflow(y);
|
||||
|
||||
y = y / (1 << sh);
|
||||
x = f16Sign(x);
|
||||
|
@ -882,7 +882,7 @@ void PGXP_CPU_SRA(u32 instr, u32 rdVal, u32 rtVal)
|
|||
else
|
||||
{
|
||||
x = x / (1 << sh);
|
||||
|
||||
|
||||
// check for potential sign extension in overflow
|
||||
psx_value valt;
|
||||
valt.d = rtVal;
|
||||
|
@ -892,7 +892,7 @@ void PGXP_CPU_SRA(u32 instr, u32 rdVal, u32 rtVal)
|
|||
else if ((valt.w.h & mask) == 0)
|
||||
x = x;
|
||||
else
|
||||
x += y * (1 << (16 - sh));//f16Overflow(y);
|
||||
x += y * (1 << (16 - sh));//f16Overflow(y);
|
||||
|
||||
y = y / (1 << sh);
|
||||
x = f16Sign(x);
|
||||
|
@ -1076,7 +1076,7 @@ void PGXP_CPU_SRLV(u32 instr, u32 rdVal, u32 rtVal, u32 rsVal)
|
|||
else
|
||||
{
|
||||
x = x / (1 << sh);
|
||||
|
||||
|
||||
// check for potential sign extension in overflow
|
||||
psx_value valt;
|
||||
valt.d = rtVal;
|
||||
|
@ -1086,7 +1086,7 @@ void PGXP_CPU_SRLV(u32 instr, u32 rdVal, u32 rtVal, u32 rsVal)
|
|||
else if ((valt.w.h & mask) == 0)
|
||||
x = x;
|
||||
else
|
||||
x += y * (1 << (16 - sh));//f16Overflow(y);
|
||||
x += y * (1 << (16 - sh));//f16Overflow(y);
|
||||
|
||||
y = y / (1 << sh);
|
||||
x = f16Sign(x);
|
||||
|
@ -1173,7 +1173,7 @@ void PGXP_CPU_SRAV(u32 instr, u32 rdVal, u32 rtVal, u32 rsVal)
|
|||
else
|
||||
{
|
||||
x = x / (1 << sh);
|
||||
|
||||
|
||||
// check for potential sign extension in overflow
|
||||
psx_value valt;
|
||||
valt.d = rtVal;
|
||||
|
@ -1183,7 +1183,7 @@ void PGXP_CPU_SRAV(u32 instr, u32 rdVal, u32 rtVal, u32 rsVal)
|
|||
else if ((valt.w.h & mask) == 0)
|
||||
x = x;
|
||||
else
|
||||
x += y * (1 << (16 - sh));//f16Overflow(y);
|
||||
x += y * (1 << (16 - sh));//f16Overflow(y);
|
||||
|
||||
y = y / (1 << sh);
|
||||
x = f16Sign(x);
|
||||
|
@ -1402,4 +1402,4 @@ void PGXP_CP0_CTC0(u32 instr, u32 rdVal, u32 rtVal)
|
|||
}
|
||||
|
||||
void PGXP_CP0_RFE(u32 instr)
|
||||
{}
|
||||
{}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "psxcommon.h"
|
||||
#include "ppf.h"
|
||||
#include "cdrom.h"
|
||||
#include <dynstr.h>
|
||||
|
||||
typedef struct tagPPF_DATA {
|
||||
s32 addr;
|
||||
|
@ -184,7 +185,7 @@ void BuildPPFCache() {
|
|||
char method, undo = 0, blockcheck = 0;
|
||||
int dizlen = 0, dizyn;
|
||||
unsigned char ppfmem[512];
|
||||
char szPPF[MAXPATHLEN];
|
||||
struct dynstr szPPF;
|
||||
int count, seekpos, pos;
|
||||
u32 anz; // use 32-bit to avoid stupid overflows
|
||||
s32 ladr, off, anx;
|
||||
|
@ -207,9 +208,10 @@ void BuildPPFCache() {
|
|||
buffer[10] = CdromId[8];
|
||||
buffer[11] = '\0';
|
||||
|
||||
sprintf(szPPF, "%s/%s", Config.PatchesDir, buffer);
|
||||
|
||||
ppffile = fopen(szPPF, "rb");
|
||||
dynstr_init(&szPPF);
|
||||
dynstr_append(&szPPF, "%s/%s", Config.PatchesDir, buffer);
|
||||
ppffile = fopen(szPPF.str, "rb");
|
||||
dynstr_free(&szPPF);
|
||||
if (ppffile == NULL) return;
|
||||
|
||||
memset(buffer, 0, 5);
|
||||
|
@ -297,7 +299,7 @@ void BuildPPFCache() {
|
|||
}
|
||||
|
||||
// now do the data reading
|
||||
do {
|
||||
do {
|
||||
fseek(ppffile, seekpos, SEEK_SET);
|
||||
fread(&pos, 4, 1, ppffile);
|
||||
pos = SWAP32(pos);
|
||||
|
@ -305,7 +307,7 @@ void BuildPPFCache() {
|
|||
if (method == 2) fread(buffer, 4, 1, ppffile); // skip 4 bytes on ppf3 (no int64 support here)
|
||||
|
||||
anz = fgetc(ppffile);
|
||||
fread(ppfmem, anz, 1, ppffile);
|
||||
fread(ppfmem, anz, 1, ppffile);
|
||||
|
||||
ladr = pos / CD_FRAMESIZE_RAW;
|
||||
off = pos % CD_FRAMESIZE_RAW;
|
||||
|
@ -391,8 +393,8 @@ boolean CheckSBI(const u8 *time) {
|
|||
|
||||
// both BCD format
|
||||
for (lcv = 0; lcv < sbicount; lcv++) {
|
||||
if (time[0] == sbitime[lcv][0] &&
|
||||
time[1] == sbitime[lcv][1] &&
|
||||
if (time[0] == sbitime[lcv][0] &&
|
||||
time[1] == sbitime[lcv][1] &&
|
||||
time[2] == sbitime[lcv][2])
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* This file contains common definitions and includes for all parts of the
|
||||
/*
|
||||
* This file contains common definitions and includes for all parts of the
|
||||
* emulator core.
|
||||
*/
|
||||
|
||||
|
@ -172,6 +172,7 @@ typedef struct {
|
|||
boolean PGXP_Cache;
|
||||
boolean PGXP_Texture;
|
||||
u32 PGXP_Mode;
|
||||
boolean GdbServer;
|
||||
#ifdef _WIN32
|
||||
char Lang[256];
|
||||
#endif
|
||||
|
|
|
@ -323,7 +323,7 @@ void psxRcntUpdate()
|
|||
}
|
||||
}
|
||||
|
||||
DebugVSync();
|
||||
if (Config.Debug) DebugVSync();
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "pgxp_debug.h"
|
||||
#include "pgxp_cpu.h"
|
||||
#include "pgxp_gte.h"
|
||||
#include "../gdbstub/gdbstub_sys.h"
|
||||
|
||||
static int branch = 0;
|
||||
static int branch2 = 0;
|
||||
|
@ -152,12 +153,12 @@ static void delayReadWrite(int reg, u32 bpc) {
|
|||
psxBranchTest();
|
||||
}
|
||||
|
||||
// this defines shall be used with the tmp
|
||||
// this defines shall be used with the tmp
|
||||
// of the next func (instead of _Funct_...)
|
||||
#define _tFunct_ ((tmp ) & 0x3F) // The funct part of the instruction register
|
||||
#define _tRd_ ((tmp >> 11) & 0x1F) // The rd part of the instruction register
|
||||
#define _tRt_ ((tmp >> 16) & 0x1F) // The rt part of the instruction register
|
||||
#define _tRs_ ((tmp >> 21) & 0x1F) // The rs part of the instruction register
|
||||
#define _tFunct_ ((tmp ) & 0x3F) // The funct part of the instruction register
|
||||
#define _tRd_ ((tmp >> 11) & 0x1F) // The rd part of the instruction register
|
||||
#define _tRt_ ((tmp >> 16) & 0x1F) // The rt part of the instruction register
|
||||
#define _tRs_ ((tmp >> 21) & 0x1F) // The rs part of the instruction register
|
||||
#define _tSa_ ((tmp >> 6) & 0x1F) // The sa part of the instruction register
|
||||
|
||||
int psxTestLoadDelay(int reg, u32 tmp) {
|
||||
|
@ -184,7 +185,7 @@ int psxTestLoadDelay(int reg, u32 tmp) {
|
|||
// SYSCALL/BREAK just a break;
|
||||
|
||||
case 0x20: case 0x21: case 0x22: case 0x23:
|
||||
case 0x24: case 0x25: case 0x26: case 0x27:
|
||||
case 0x24: case 0x25: case 0x26: case 0x27:
|
||||
case 0x2a: case 0x2b: // ADD/ADDU...
|
||||
case 0x04: case 0x06: case 0x07: // SLLV...
|
||||
if (_tRd_ == reg && (_tRt_ == reg || _tRs_ == reg)) return 1; else
|
||||
|
@ -271,7 +272,7 @@ int psxTestLoadDelay(int reg, u32 tmp) {
|
|||
|
||||
case 0x12: // COP2
|
||||
switch (_tFunct_) {
|
||||
case 0x00:
|
||||
case 0x00:
|
||||
switch (_tRs_) {
|
||||
case 0x00: // MFC2
|
||||
if (_tRt_ == reg) return 3;
|
||||
|
@ -721,9 +722,9 @@ void psxLB() {
|
|||
|
||||
|
||||
if (_Rt_) {
|
||||
_i32(_rRt_) = (signed char)psxMemRead8(_oB_);
|
||||
_i32(_rRt_) = (signed char)psxMemRead8(_oB_);
|
||||
} else {
|
||||
psxMemRead8(_oB_);
|
||||
psxMemRead8(_oB_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -743,7 +744,7 @@ void psxLBU() {
|
|||
if (_Rt_) {
|
||||
_u32(_rRt_) = psxMemRead8(_oB_);
|
||||
} else {
|
||||
psxMemRead8(_oB_);
|
||||
psxMemRead8(_oB_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -828,7 +829,7 @@ void psxLWL() {
|
|||
|
||||
|
||||
if (!_Rt_) return;
|
||||
_u32(_rRt_) = ( _u32(_rRt_) & LWL_MASK[shift]) |
|
||||
_u32(_rRt_) = ( _u32(_rRt_) & LWL_MASK[shift]) |
|
||||
( mem << LWL_SHIFT[shift]);
|
||||
|
||||
/*
|
||||
|
@ -850,7 +851,7 @@ void psxLWR() {
|
|||
u32 mem = psxMemRead32(addr & ~3);
|
||||
|
||||
|
||||
|
||||
|
||||
// load delay = 1 latency
|
||||
if( branch == 0 )
|
||||
{
|
||||
|
@ -864,7 +865,7 @@ void psxLWR() {
|
|||
|
||||
|
||||
if (!_Rt_) return;
|
||||
_u32(_rRt_) = ( _u32(_rRt_) & LWR_MASK[shift]) |
|
||||
_u32(_rRt_) = ( _u32(_rRt_) & LWR_MASK[shift]) |
|
||||
( mem >> LWR_SHIFT[shift]);
|
||||
|
||||
/*
|
||||
|
@ -940,7 +941,7 @@ void psxMFC0()
|
|||
|
||||
|
||||
if (!_Rt_) return;
|
||||
|
||||
|
||||
_i32(_rRt_) = (int)_rFs_;
|
||||
}
|
||||
|
||||
|
@ -958,7 +959,7 @@ void psxCFC0()
|
|||
|
||||
|
||||
if (!_Rt_) return;
|
||||
|
||||
|
||||
_i32(_rRt_) = (int)_rFs_;
|
||||
}
|
||||
|
||||
|
@ -1031,7 +1032,7 @@ void psxCFC2()
|
|||
* Unknow instruction (would generate an exception) *
|
||||
* Format: ? *
|
||||
*********************************************************/
|
||||
void psxNULL() {
|
||||
void psxNULL() {
|
||||
#ifdef PSXCPU_LOG
|
||||
PSXCPU_LOG("psx: Unimplemented op %x\n", psxRegs.code);
|
||||
#endif
|
||||
|
@ -1071,9 +1072,9 @@ void (*psxBSC[64])() = {
|
|||
psxCOP0 , psxNULL , psxCOP2, psxNULL , psxNULL, psxNULL, psxNULL, psxNULL,
|
||||
psxNULL , psxNULL , psxNULL, psxNULL , psxNULL, psxNULL, psxNULL, psxNULL,
|
||||
psxLB , psxLH , psxLWL , psxLW , psxLBU , psxLHU , psxLWR , psxNULL,
|
||||
psxSB , psxSH , psxSWL , psxSW , psxNULL, psxNULL, psxSWR , psxNULL,
|
||||
psxSB , psxSH , psxSWL , psxSW , psxNULL, psxNULL, psxSWR , psxNULL,
|
||||
psxNULL , psxNULL , gteLWC2, psxNULL , psxNULL, psxNULL, psxNULL, psxNULL,
|
||||
psxNULL , psxNULL , gteSWC2, psxHLE , psxNULL, psxNULL, psxNULL, psxNULL
|
||||
psxNULL , psxNULL , gteSWC2, psxHLE , psxNULL, psxNULL, psxNULL, psxNULL
|
||||
};
|
||||
|
||||
|
||||
|
@ -1108,7 +1109,7 @@ void (*psxCP2[64])() = {
|
|||
gteDPCS , gteINTPL, gteMVMVA, gteNCDS, gteCDP , psxNULL , gteNCDT , psxNULL, // 10
|
||||
psxNULL , psxNULL , psxNULL , gteNCCS, gteCC , psxNULL , gteNCS , psxNULL, // 18
|
||||
gteNCT , psxNULL , psxNULL , psxNULL, psxNULL, psxNULL , psxNULL , psxNULL, // 20
|
||||
gteSQR , gteDCPL , gteDPCT , psxNULL, psxNULL, gteAVSZ3, gteAVSZ4, psxNULL, // 28
|
||||
gteSQR , gteDCPL , gteDPCT , psxNULL, psxNULL, gteAVSZ3, gteAVSZ4, psxNULL, // 28
|
||||
gteRTPT , psxNULL , psxNULL , psxNULL, psxNULL, psxNULL , psxNULL , psxNULL, // 30
|
||||
psxNULL , psxNULL , psxNULL , psxNULL, psxNULL, gteGPF , gteGPL , gteNCCT // 38
|
||||
};
|
||||
|
@ -1182,7 +1183,7 @@ static void intReset() {
|
|||
}
|
||||
|
||||
static void intExecute() {
|
||||
for (;;)
|
||||
for (;;)
|
||||
execI();
|
||||
}
|
||||
|
||||
|
@ -1197,14 +1198,77 @@ static void intClear(u32 Addr, u32 Size) {
|
|||
static void intShutdown() {
|
||||
}
|
||||
|
||||
static void process_gdb(void) {
|
||||
static int shutdown;
|
||||
static u32 tgt_addr;
|
||||
static int step, must_continue;
|
||||
struct msg msg;
|
||||
|
||||
if (shutdown)
|
||||
return;
|
||||
|
||||
if (step || (must_continue && tgt_addr && tgt_addr == psxRegs.pc)) {
|
||||
msg.type = MSG_TYPE_HIT;
|
||||
#if DEBUG == 1
|
||||
printf("hit address 0x%08X\n", psxRegs.pc);
|
||||
#endif
|
||||
gdbstub_sys_send(&msg);
|
||||
must_continue = 0;
|
||||
step = 0;
|
||||
}
|
||||
|
||||
if (!must_continue) {
|
||||
gdbstub_sys_recv(&msg);
|
||||
|
||||
switch (msg.type) {
|
||||
case MSG_TYPE_CONTINUE:
|
||||
must_continue = 1;
|
||||
break;
|
||||
|
||||
case MSG_TYPE_STEP:
|
||||
step = 1;
|
||||
break;
|
||||
|
||||
case MSG_TYPE_REMOVE_BREAKPOINT: {
|
||||
struct msg out;
|
||||
|
||||
tgt_addr = 0;
|
||||
out.type = MSG_TYPE_ACK;
|
||||
|
||||
gdbstub_sys_send(&out);
|
||||
}
|
||||
break;
|
||||
|
||||
case MSG_TYPE_BREAKPOINT: {
|
||||
struct msg out;
|
||||
|
||||
tgt_addr = msg.data.breakpoint.addr;
|
||||
out.type = MSG_TYPE_ACK;
|
||||
|
||||
gdbstub_sys_send(&out);
|
||||
}
|
||||
break;
|
||||
|
||||
case MSG_TYPE_SHUTDOWN:
|
||||
shutdown = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "unknown msg.type %d\n", msg.type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// interpreter execution
|
||||
static inline void execI() {
|
||||
static inline void execI() {
|
||||
u32 *code = Read_ICache(psxRegs.pc, FALSE);
|
||||
psxRegs.code = ((code == NULL) ? 0 : SWAP32(*code));
|
||||
|
||||
debugI();
|
||||
|
||||
if (Config.Debug) ProcessDebug();
|
||||
if (Config.GdbServer) process_gdb();
|
||||
else if (Config.Debug) ProcessDebug();
|
||||
|
||||
psxRegs.pc += 4;
|
||||
psxRegs.cycle += BIAS;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "psxcommon.h"
|
||||
#include "socket.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/socket.h>
|
||||
|
@ -31,17 +32,10 @@
|
|||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
static int server_socket = 0;
|
||||
static int client_socket = 0;
|
||||
|
||||
static char tbuf[513];
|
||||
static int ptr = 0;
|
||||
|
||||
#define PORT_NUMBER 12345
|
||||
|
||||
int StartServer() {
|
||||
int StartServer(unsigned short port) {
|
||||
struct in_addr localhostaddr;
|
||||
struct sockaddr_in localsocketaddr;
|
||||
int ret;
|
||||
|
||||
#ifdef _WIN32
|
||||
WSADATA wsaData;
|
||||
|
@ -50,17 +44,17 @@ int StartServer() {
|
|||
return -1;
|
||||
#endif
|
||||
|
||||
server_socket = socket(AF_INET, SOCK_STREAM, 0);
|
||||
ret = socket(AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (server_socket == INVALID_SOCKET)
|
||||
if (ret == INVALID_SOCKET)
|
||||
return -1;
|
||||
#else
|
||||
if (server_socket == -1)
|
||||
return -1;
|
||||
if (ret == -1)
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
SetsNonblock();
|
||||
SetsNonblock(ret);
|
||||
|
||||
memset((void *)&localhostaddr, 0, sizeof(localhostaddr));
|
||||
memset(&localsocketaddr, 0, sizeof(struct sockaddr_in));
|
||||
|
@ -72,59 +66,51 @@ int StartServer() {
|
|||
#endif
|
||||
localsocketaddr.sin_family = AF_INET;
|
||||
localsocketaddr.sin_addr = localhostaddr;
|
||||
localsocketaddr.sin_port = htons(PORT_NUMBER);
|
||||
localsocketaddr.sin_port = htons(port);
|
||||
|
||||
if (bind(server_socket, (struct sockaddr *) &localsocketaddr, sizeof(localsocketaddr)) < 0)
|
||||
if (bind(ret, (struct sockaddr *) &localsocketaddr, sizeof(localsocketaddr)) < 0)
|
||||
return -1;
|
||||
|
||||
if (listen(server_socket, 1) != 0)
|
||||
if (listen(ret, 1) != 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void StopServer() {
|
||||
void StopServer(int s_socket) {
|
||||
#ifdef _WIN32
|
||||
shutdown(server_socket, SD_BOTH);
|
||||
closesocket(server_socket);
|
||||
shutdown(s_socket, SD_BOTH);
|
||||
closesocket(s_socket);
|
||||
WSACleanup();
|
||||
#else
|
||||
shutdown(server_socket, SHUT_RDWR);
|
||||
close(server_socket);
|
||||
shutdown(s_socket, SHUT_RDWR);
|
||||
close(s_socket);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GetClient() {
|
||||
int new_socket;
|
||||
char hello[256];
|
||||
int GetClient(int s_socket, int blocking) {
|
||||
int new_socket = accept(s_socket, NULL, NULL);
|
||||
|
||||
new_socket = accept(server_socket, 0, 0);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (new_socket == INVALID_SOCKET)
|
||||
return;
|
||||
return -1;
|
||||
#else
|
||||
if (new_socket == -1)
|
||||
return;
|
||||
return -1;
|
||||
#endif
|
||||
if (client_socket)
|
||||
CloseClient();
|
||||
client_socket = new_socket;
|
||||
|
||||
#ifndef _WIN32
|
||||
if (!blocking)
|
||||
{
|
||||
int flags;
|
||||
flags = fcntl(client_socket, F_GETFL, 0);
|
||||
fcntl(client_socket, F_SETFL, flags | O_NONBLOCK);
|
||||
flags = fcntl(new_socket, F_GETFL, 0);
|
||||
fcntl(new_socket, F_SETFL, flags | O_NONBLOCK);
|
||||
return new_socket;
|
||||
}
|
||||
#endif
|
||||
|
||||
sprintf(hello, "000 PCSXR Version %s - Debug console\r\n", PACKAGE_VERSION);
|
||||
WriteSocket(hello, strlen(hello));
|
||||
ptr = 0;
|
||||
}
|
||||
|
||||
void CloseClient() {
|
||||
void CloseClient(int client_socket) {
|
||||
if (client_socket) {
|
||||
#ifdef _WIN32
|
||||
shutdown(client_socket, SD_BOTH);
|
||||
|
@ -133,28 +119,69 @@ void CloseClient() {
|
|||
shutdown(client_socket, SHUT_RDWR);
|
||||
close(client_socket);
|
||||
#endif
|
||||
client_socket = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int HasClient() {
|
||||
return client_socket ? 1 : 0;
|
||||
int HasClient(int client_socket) {
|
||||
return client_socket > 0;
|
||||
}
|
||||
|
||||
int ReadSocket(char * buffer, int len) {
|
||||
int r;
|
||||
#ifdef _WIN32
|
||||
|
||||
static enum read_socket_err ReadSocketOS(SOCKET client_socket, char *buf, size_t *const len)
|
||||
{
|
||||
const int res = recv(client_socket, buf, len, 0);
|
||||
|
||||
switch (res)
|
||||
{
|
||||
case SOCKET_ERROR:
|
||||
return READ_SOCKET_ERR_RECV;
|
||||
|
||||
case 0:
|
||||
return READ_SOCKET_SHUTDOWN;
|
||||
|
||||
default:
|
||||
*len = res;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return READ_SOCKET_OK;
|
||||
}
|
||||
|
||||
#elif defined(_POSIX_VERSION)
|
||||
|
||||
static enum read_socket_err ReadSocketOS(int client_socket, char *buf, size_t *const len)
|
||||
{
|
||||
const ssize_t res = recv(client_socket, buf, *len, 0);
|
||||
|
||||
switch (res)
|
||||
{
|
||||
case -1:
|
||||
return READ_SOCKET_ERR_RECV;
|
||||
|
||||
case 0:
|
||||
return READ_SOCKET_SHUTDOWN;
|
||||
|
||||
default:
|
||||
*len = res;
|
||||
break;
|
||||
}
|
||||
|
||||
return READ_SOCKET_OK;
|
||||
}
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
enum read_socket_err ReadSocket(int client_socket, char *buf, size_t *const len) {
|
||||
char * endl;
|
||||
|
||||
if (!client_socket)
|
||||
return -1;
|
||||
if (!client_socket || !buf || !len || !*len)
|
||||
return READ_SOCKET_ERR_INVALID_ARG;
|
||||
|
||||
r = recv(client_socket, tbuf + ptr, 512 - ptr, 0);
|
||||
return ReadSocketOS(client_socket, buf, len);
|
||||
|
||||
if (r == 0) {
|
||||
client_socket = 0;
|
||||
if (!ptr)
|
||||
return 0;
|
||||
}
|
||||
#if 0
|
||||
#ifdef _WIN32
|
||||
if (r == SOCKET_ERROR)
|
||||
#else
|
||||
|
@ -185,11 +212,11 @@ int ReadSocket(char * buffer, int len) {
|
|||
}
|
||||
|
||||
buffer[r] = 0;
|
||||
|
||||
return r;
|
||||
#endif
|
||||
}
|
||||
|
||||
int RawReadSocket(char * buffer, int len) {
|
||||
int RawReadSocket(int client_socket, char *buffer, size_t len) {
|
||||
#if 0
|
||||
int r = 0;
|
||||
int mlen = len < ptr ? len : ptr;
|
||||
|
||||
|
@ -206,7 +233,6 @@ int RawReadSocket(char * buffer, int len) {
|
|||
r = recv(client_socket, buffer + mlen, len - mlen, 0);
|
||||
|
||||
if (r == 0) {
|
||||
client_socket = 0;
|
||||
if (!ptr)
|
||||
return 0;
|
||||
}
|
||||
|
@ -224,31 +250,34 @@ int RawReadSocket(char * buffer, int len) {
|
|||
r += mlen;
|
||||
|
||||
return r;
|
||||
#endif
|
||||
}
|
||||
|
||||
void WriteSocket(char * buffer, int len) {
|
||||
if (!client_socket)
|
||||
void WriteSocket(int client_socket, const void *buffer, size_t len) {
|
||||
if (client_socket <= 0)
|
||||
return;
|
||||
|
||||
send(client_socket, buffer, len, 0);
|
||||
if (send(client_socket, buffer, len, 0) == -1) {
|
||||
perror("send():");
|
||||
}
|
||||
}
|
||||
|
||||
void SetsBlock() {
|
||||
void SetsBlock(int s_socket) {
|
||||
#ifdef _WIN32
|
||||
u_long b = 0;
|
||||
ioctlsocket(server_socket, FIONBIO, &b);
|
||||
ioctlsocket(s_socket, FIONBIO, &b);
|
||||
#else
|
||||
int flags = fcntl(server_socket, F_GETFL, 0);
|
||||
fcntl(server_socket, F_SETFL, flags & ~O_NONBLOCK);
|
||||
int flags = fcntl(s_socket, F_GETFL, 0);
|
||||
fcntl(s_socket, F_SETFL, flags & ~O_NONBLOCK);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetsNonblock() {
|
||||
void SetsNonblock(int s_socket) {
|
||||
#ifdef _WIN32
|
||||
u_long b = 1;
|
||||
ioctlsocket(server_socket, FIONBIO, &b);
|
||||
ioctlsocket(s_socket, FIONBIO, &b);
|
||||
#else
|
||||
int flags = fcntl(server_socket, F_GETFL, 0);
|
||||
fcntl(server_socket, F_SETFL, flags | O_NONBLOCK);
|
||||
int flags = fcntl(s_socket, F_GETFL, 0);
|
||||
fcntl(s_socket, F_SETFL, flags | O_NONBLOCK);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -22,20 +22,30 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
int StartServer();
|
||||
void StopServer();
|
||||
#include <stddef.h>
|
||||
|
||||
void GetClient();
|
||||
void CloseClient();
|
||||
enum read_socket_err
|
||||
{
|
||||
READ_SOCKET_OK,
|
||||
READ_SOCKET_ERR_INVALID_ARG,
|
||||
READ_SOCKET_ERR_RECV,
|
||||
READ_SOCKET_SHUTDOWN
|
||||
};
|
||||
|
||||
int HasClient();
|
||||
int StartServer(unsigned short port);
|
||||
void StopServer(int s_socket);
|
||||
|
||||
int ReadSocket(char * buffer, int len);
|
||||
int RawReadSocket(char * buffer, int len);
|
||||
void WriteSocket(char * buffer, int len);
|
||||
int GetClient(int s_socket, int blocking);
|
||||
void CloseClient(int client_socket);
|
||||
|
||||
void SetsBlock();
|
||||
void SetsNonblock();
|
||||
int HasClient(int client_socket);
|
||||
|
||||
enum read_socket_err ReadSocket(int client_socket, char *buffer, size_t *len);
|
||||
int RawReadSocket(int client_socket, char *buffer, size_t len);
|
||||
void WriteSocket(int client_socket, const void *buffer, size_t len);
|
||||
|
||||
void SetsBlock(int s_socket);
|
||||
void SetsNonblock(int s_socket);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ void CALLBACK GPUpgxpCacheVertex(short sx, short sy, const unsigned char* _pVert
|
|||
if ((fabsf(pOldVertex->x - pNewVertex->x) > 0.1f) ||
|
||||
(fabsf(pOldVertex->y - pNewVertex->y) > 0.1f) ||
|
||||
(fabsf(pOldVertex->z - pNewVertex->z) > 0.1f))
|
||||
{
|
||||
{
|
||||
pOldVertex->mFlags = 5;
|
||||
return;
|
||||
}
|
||||
|
@ -390,6 +390,11 @@ int PGXP_GetVertices(unsigned int* addr, void* pOutput, int xOffs, int yOffs)
|
|||
|
||||
// calculate offset to actual data
|
||||
int offset = 0;
|
||||
|
||||
/* Dirty hack */
|
||||
if (!pDMABlock)
|
||||
return 0;
|
||||
|
||||
while ((pDMABlock[offset] != *addr) && (offset < blockSize))
|
||||
{
|
||||
unsigned char command = (unsigned char)((pDMABlock[offset] >> 24) & 0xff);
|
||||
|
@ -455,7 +460,7 @@ int PGXP_GetVertices(unsigned int* addr, void* pOutput, int xOffs, int yOffs)
|
|||
}
|
||||
|
||||
// Log incorrect vertices
|
||||
//if (PGXP_tDebug &&
|
||||
//if (PGXP_tDebug &&
|
||||
// (fabs((float)pPrimData[stride * i * 2] - primStart[stride * i].x) > debug_tolerance) ||
|
||||
// (fabs((float)pPrimData[(stride * i * 2) + 1] - primStart[stride * i].y) > debug_tolerance))
|
||||
// __Log("GPPV: v:%x (%d, %d) pgxp(%f, %f)|\n", (currentAddr + offset + 1 + (i * stride)) * 4, pPrimData[stride * i * 2], pPrimData[(stride * i * 2) + 1], primStart[stride * i].x, primStart[stride * i].y);
|
||||
|
@ -527,7 +532,7 @@ enum PGXP_vDebugMode
|
|||
vDEBUG_MAX,
|
||||
|
||||
vDEBUG_TEXCOORD,
|
||||
vDEBUG_ID,
|
||||
vDEBUG_ID,
|
||||
};
|
||||
|
||||
const char red[4] = { 255, 0, 0, 255 };
|
||||
|
@ -569,7 +574,7 @@ void ColourFromRange(float val, float min, float max, GLubyte alpha, int wrap)
|
|||
if (wrap)
|
||||
val = fmod(val, 1);
|
||||
|
||||
if (0 <= val && val<= 1.f / 8.f)
|
||||
if (0 <= val && val<= 1.f / 8.f)
|
||||
{
|
||||
r = 0;
|
||||
g = 0;
|
||||
|
@ -672,7 +677,7 @@ void PGXP_colour(OGLVertex* vertex, GLubyte alpha, int prim, int isTextured, int
|
|||
glColor4ubv(vertex->c.col);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case vDEBUG_TEXTURE:
|
||||
// Texture only
|
||||
|
@ -830,4 +835,4 @@ int PGXP_DrawDebugQuad(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* vertex
|
|||
int PGXP_DrawDebugTriQuad(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* vertex3, OGLVertex* vertex4, int colourMode, int isTextured)
|
||||
{
|
||||
return DrawDebugPrim(DRAW_TRIQUAD, vertex1, vertex2, vertex3, vertex4, colourMode, isTextured);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -225,6 +225,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
|
||||
return 0;
|
||||
}
|
||||
else if (strcmp(arg, "-gdb") == 0) {
|
||||
/* Force configuration. */
|
||||
Config.Cpu = CPU_INTERPRETER;
|
||||
Config.GdbServer = 1;
|
||||
dbg_start();
|
||||
}
|
||||
}
|
||||
|
||||
if (SysInit() == -1) return 1;
|
||||
|
@ -238,6 +244,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
|
||||
RunGui();
|
||||
|
||||
if (Config.GdbServer) dbg_stop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -261,10 +269,10 @@ void RestoreWindow() {
|
|||
AccBreak = 1;
|
||||
DestroyWindow(gApp.hWnd);
|
||||
CreateMainWindow(SW_SHOWNORMAL);
|
||||
|
||||
|
||||
if(Config.HideCursor)
|
||||
ShowCursor(TRUE);
|
||||
|
||||
|
||||
//SetCursor(LoadCursor(gApp.hInstance, IDC_ARROW));
|
||||
//ShowCursor(TRUE);
|
||||
|
||||
|
@ -279,7 +287,7 @@ void ResetMenuSlots() {
|
|||
GetStateFilename(str, i);
|
||||
if (CheckState(str) == -1)
|
||||
EnableMenuItem(gApp.hMenu, ID_FILE_STATES_LOAD_SLOT1+i, MF_GRAYED);
|
||||
else
|
||||
else
|
||||
EnableMenuItem(gApp.hMenu, ID_FILE_STATES_LOAD_SLOT1+i, MF_ENABLED);
|
||||
}
|
||||
}
|
||||
|
@ -382,7 +390,7 @@ void OnStates_LoadOther() {
|
|||
Running = 1;
|
||||
psxCpu->Execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnStates_SaveOther() {
|
||||
OPENFILENAME ofn;
|
||||
|
@ -428,7 +436,7 @@ void OnStates_SaveOther() {
|
|||
Running = 1;
|
||||
psxCpu->Execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
char File[256];
|
||||
|
@ -475,7 +483,7 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
SysMessage(_("The CD does not appear to be a valid Playstation CD"));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// Auto-detect: region first, then rcnt reset
|
||||
SysReset();
|
||||
|
||||
|
@ -532,7 +540,7 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
|
||||
// Auto-detect: region first, then rcnt reset
|
||||
SysReset();
|
||||
|
||||
|
||||
if (LoadCdrom() == -1) {
|
||||
ClosePlugins();
|
||||
RestoreWindow();
|
||||
|
@ -559,7 +567,7 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
|
||||
// Auto-detect: region first, then rcnt reset
|
||||
SysReset();
|
||||
|
||||
|
||||
Load(File);
|
||||
Running = 1;
|
||||
psxCpu->Execute();
|
||||
|
@ -604,7 +612,7 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
|
||||
// Auto-detect: region first, then rcnt reset
|
||||
SysReset();
|
||||
|
||||
|
||||
if (LoadCdrom() == -1) {
|
||||
fprintf(stderr, _("Could not load CD-ROM!"));
|
||||
ClosePlugins();
|
||||
|
@ -634,7 +642,7 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
|
||||
// Auto-detect: region first, then rcnt reset
|
||||
SysReset();
|
||||
|
||||
|
||||
LoadCdrom();
|
||||
if(Config.HideCursor)
|
||||
ShowCursor(FALSE);
|
||||
|
@ -820,48 +828,48 @@ void CreateListView(int idc) {
|
|||
|
||||
int GetRGB() {
|
||||
HDC scrDC, memDC;
|
||||
HBITMAP oldBmp = NULL;
|
||||
HBITMAP oldBmp = NULL;
|
||||
HBITMAP curBmp = NULL;
|
||||
COLORREF oldColor;
|
||||
COLORREF curColor = RGB(255,255,255);
|
||||
int i, R, G, B;
|
||||
|
||||
R = G = B = 1;
|
||||
|
||||
|
||||
scrDC = CreateDC("DISPLAY", NULL, NULL, NULL);
|
||||
memDC = CreateCompatibleDC(NULL);
|
||||
curBmp = CreateCompatibleBitmap(scrDC, 1, 1);
|
||||
memDC = CreateCompatibleDC(NULL);
|
||||
curBmp = CreateCompatibleBitmap(scrDC, 1, 1);
|
||||
oldBmp = (HBITMAP)SelectObject(memDC, curBmp);
|
||||
|
||||
|
||||
for (i = 255; i >= 0; --i) {
|
||||
oldColor = curColor;
|
||||
curColor = SetPixel(memDC, 0, 0, RGB(i, i, i));
|
||||
|
||||
if (GetRValue(curColor) < GetRValue(oldColor)) ++R;
|
||||
|
||||
if (GetRValue(curColor) < GetRValue(oldColor)) ++R;
|
||||
if (GetGValue(curColor) < GetGValue(oldColor)) ++G;
|
||||
if (GetBValue(curColor) < GetBValue(oldColor)) ++B;
|
||||
}
|
||||
|
||||
|
||||
DeleteObject(oldBmp);
|
||||
DeleteObject(curBmp);
|
||||
DeleteDC(scrDC);
|
||||
DeleteDC(memDC);
|
||||
|
||||
|
||||
return (R * G * B);
|
||||
}
|
||||
|
||||
|
||||
HICON GetIcon(short *icon) {
|
||||
ICONINFO iInfo;
|
||||
HDC hDC;
|
||||
char mask[16*16];
|
||||
int x, y, c, Depth;
|
||||
|
||||
|
||||
hDC = CreateIC("DISPLAY",NULL,NULL,NULL);
|
||||
Depth=GetDeviceCaps(hDC, BITSPIXEL);
|
||||
DeleteDC(hDC);
|
||||
|
||||
|
||||
if (Depth == 16) {
|
||||
if (GetRGB() == (32 * 32 * 32))
|
||||
if (GetRGB() == (32 * 32 * 32))
|
||||
Depth = 15;
|
||||
}
|
||||
|
||||
|
@ -869,8 +877,8 @@ HICON GetIcon(short *icon) {
|
|||
for (x=0; x<16; x++) {
|
||||
c = icon[y*16+x];
|
||||
if (Depth == 15 || Depth == 32)
|
||||
c = ((c&0x001f) << 10) |
|
||||
((c&0x7c00) >> 10) |
|
||||
c = ((c&0x001f) << 10) |
|
||||
((c&0x7c00) >> 10) |
|
||||
((c&0x03e0) );
|
||||
else
|
||||
c = ((c&0x001f) << 11) |
|
||||
|
@ -879,20 +887,20 @@ HICON GetIcon(short *icon) {
|
|||
|
||||
icon[y*16+x] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
iInfo.fIcon = TRUE;
|
||||
memset(mask, 0, 16*16);
|
||||
iInfo.hbmMask = CreateBitmap(16, 16, 1, 1, mask);
|
||||
iInfo.hbmColor = CreateBitmap(16, 16, 1, 16, icon);
|
||||
|
||||
iInfo.hbmColor = CreateBitmap(16, 16, 1, 16, icon);
|
||||
|
||||
return CreateIconIndirect(&iInfo);
|
||||
}
|
||||
|
||||
HICON hICON[2][3][15];
|
||||
int aIover[2];
|
||||
int aIover[2];
|
||||
int ani[2];
|
||||
|
||||
|
||||
void LoadMcdItems(int mcd, int idc) {
|
||||
HWND List = GetDlgItem(mcdDlg, idc);
|
||||
LV_ITEM item;
|
||||
|
@ -900,37 +908,37 @@ void LoadMcdItems(int mcd, int idc) {
|
|||
int i, j;
|
||||
HICON hIcon;
|
||||
McdBlock *Info;
|
||||
|
||||
|
||||
aIover[mcd-1]=0;
|
||||
ani[mcd-1]=0;
|
||||
|
||||
|
||||
ListView_DeleteAllItems(List);
|
||||
|
||||
for (i=0; i<15; i++) {
|
||||
|
||||
|
||||
item.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||
item.iItem = i;
|
||||
item.iImage = i;
|
||||
item.pszText = LPSTR_TEXTCALLBACK;
|
||||
item.iSubItem = 0;
|
||||
|
||||
|
||||
IconC[mcd-1][i] = 0;
|
||||
Info = &Blocks[mcd-1][i];
|
||||
|
||||
|
||||
if ((Info->Flags & 0xF) == 1 && Info->IconCount != 0) {
|
||||
hIcon = GetIcon(Info->Icon);
|
||||
|
||||
hIcon = GetIcon(Info->Icon);
|
||||
|
||||
if (Info->IconCount > 1) {
|
||||
for(j = 0; j < 3; j++)
|
||||
hICON[mcd-1][j][i]=hIcon;
|
||||
}
|
||||
} else {
|
||||
hIcon = eICON;
|
||||
hIcon = eICON;
|
||||
}
|
||||
|
||||
|
||||
ImageList_ReplaceIcon(iml, -1, hIcon);
|
||||
ListView_InsertItem(List, &item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateMcdItems(int mcd, int idc) {
|
||||
|
@ -940,38 +948,38 @@ void UpdateMcdItems(int mcd, int idc) {
|
|||
int i, j;
|
||||
McdBlock *Info;
|
||||
HICON hIcon;
|
||||
|
||||
|
||||
aIover[mcd-1]=0;
|
||||
ani[mcd-1]=0;
|
||||
|
||||
for (i=0; i<15; i++) {
|
||||
|
||||
|
||||
for (i=0; i<15; i++) {
|
||||
|
||||
item.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||
item.iItem = i;
|
||||
item.iImage = i;
|
||||
item.pszText = LPSTR_TEXTCALLBACK;
|
||||
item.iSubItem = 0;
|
||||
|
||||
IconC[mcd-1][i] = 0;
|
||||
|
||||
IconC[mcd-1][i] = 0;
|
||||
Info = &Blocks[mcd-1][i];
|
||||
|
||||
|
||||
if ((Info->Flags & 0xF) == 1 && Info->IconCount != 0) {
|
||||
hIcon = GetIcon(Info->Icon);
|
||||
|
||||
if (Info->IconCount > 1) {
|
||||
hIcon = GetIcon(Info->Icon);
|
||||
|
||||
if (Info->IconCount > 1) {
|
||||
for(j = 0; j < 3; j++)
|
||||
hICON[mcd-1][j][i]=hIcon;
|
||||
}
|
||||
} else {
|
||||
hIcon = eICON;
|
||||
} else {
|
||||
hIcon = eICON;
|
||||
}
|
||||
|
||||
|
||||
ImageList_ReplaceIcon(iml, i, hIcon);
|
||||
ListView_SetItem(List, &item);
|
||||
}
|
||||
}
|
||||
ListView_Update(List, -1);
|
||||
}
|
||||
|
||||
|
||||
void McdListGetDispInfo(int mcd, int idc, LPNMHDR pnmh) {
|
||||
LV_DISPINFO *lpdi = (LV_DISPINFO *)pnmh;
|
||||
McdBlock *Info;
|
||||
|
@ -1050,22 +1058,22 @@ void UpdateMcdIcon(int mcd, int idc) {
|
|||
HIMAGELIST iml = Iiml[mcd-1];
|
||||
int i;
|
||||
McdBlock *Info;
|
||||
int *count;
|
||||
|
||||
int *count;
|
||||
|
||||
if(!aIover[mcd-1]) {
|
||||
ani[mcd-1]++;
|
||||
|
||||
ani[mcd-1]++;
|
||||
|
||||
for (i=0; i<15; i++) {
|
||||
Info = &Blocks[mcd-1][i];
|
||||
count = &IconC[mcd-1][i];
|
||||
|
||||
|
||||
if ((Info->Flags & 0xF) != 1) continue;
|
||||
if (Info->IconCount <= 1) continue;
|
||||
|
||||
|
||||
if (*count < Info->IconCount) {
|
||||
(*count)++;
|
||||
aIover[mcd-1]=0;
|
||||
|
||||
|
||||
if(ani[mcd-1] <= (Info->IconCount-1)) // last frame and below...
|
||||
hICON[mcd-1][ani[mcd-1]][i] = GetIcon(&Info->Icon[(*count)*16*16]);
|
||||
} else {
|
||||
|
@ -1073,14 +1081,14 @@ void UpdateMcdIcon(int mcd, int idc) {
|
|||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
} else {
|
||||
|
||||
if (ani[mcd-1] > 1) ani[mcd-1] = 0; // 1st frame
|
||||
else ani[mcd-1]++; // 2nd, 3rd frame
|
||||
|
||||
|
||||
for(i=0;i<15;i++) {
|
||||
Info = &Blocks[mcd-1][i];
|
||||
|
||||
|
||||
if (((Info->Flags & 0xF) == 1) && (Info->IconCount > 1))
|
||||
ImageList_ReplaceIcon(iml, i, hICON[mcd-1][ani[mcd-1]][i]);
|
||||
}
|
||||
|
@ -1116,7 +1124,7 @@ BOOL CALLBACK ConfigureMcdsDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
Button_SetText(GetDlgItem(hW, IDC_PASTE), _("Paste"));
|
||||
Button_SetText(GetDlgItem(hW, IDC_DELETE1), _("<- Un/Delete"));
|
||||
Button_SetText(GetDlgItem(hW, IDC_DELETE2), _("Un/Delete ->"));
|
||||
|
||||
|
||||
Static_SetText(GetDlgItem(hW, IDC_FRAMEMCD1), _("Memory Card 1"));
|
||||
Static_SetText(GetDlgItem(hW, IDC_FRAMEMCD2), _("Memory Card 2"));
|
||||
|
||||
|
@ -1143,10 +1151,10 @@ BOOL CALLBACK ConfigureMcdsDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
|
||||
CreateListView(IDC_LIST1);
|
||||
CreateListView(IDC_LIST2);
|
||||
|
||||
|
||||
Iiml[0] = ImageList_Create(16, 16, ILC_COLOR16, 0, 0);
|
||||
Iiml[1] = ImageList_Create(16, 16, ILC_COLOR16, 0, 0);
|
||||
|
||||
|
||||
ListView_SetImageList(GetDlgItem(mcdDlg, IDC_LIST1), Iiml[0], LVSIL_SMALL);
|
||||
ListView_SetImageList(GetDlgItem(mcdDlg, IDC_LIST2), Iiml[1], LVSIL_SMALL);
|
||||
|
||||
|
@ -1274,18 +1282,18 @@ BOOL CALLBACK ConfigureMcdsDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
|
||||
return TRUE;
|
||||
|
||||
case IDC_MCDSEL1:
|
||||
Open_Mcd_Proc(hW, 1);
|
||||
case IDC_MCDSEL1:
|
||||
Open_Mcd_Proc(hW, 1);
|
||||
return TRUE;
|
||||
case IDC_MCDSEL2:
|
||||
Open_Mcd_Proc(hW, 2);
|
||||
case IDC_MCDSEL2:
|
||||
Open_Mcd_Proc(hW, 2);
|
||||
return TRUE;
|
||||
case IDC_RELOAD1:
|
||||
case IDC_RELOAD1:
|
||||
Edit_GetText(GetDlgItem(hW,IDC_MCD1), str, 256);
|
||||
LoadMcd(1, str);
|
||||
UpdateMcdDlg();
|
||||
return TRUE;
|
||||
case IDC_RELOAD2:
|
||||
case IDC_RELOAD2:
|
||||
Edit_GetText(GetDlgItem(hW,IDC_MCD2), str, 256);
|
||||
LoadMcd(2, str);
|
||||
UpdateMcdDlg();
|
||||
|
@ -1340,12 +1348,12 @@ BOOL CALLBACK ConfigureMcdsDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
}
|
||||
|
||||
|
||||
BOOL CALLBACK ConfigurePGXPDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
BOOL CALLBACK ConfigurePGXPDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
long tmp;
|
||||
RECT rect;
|
||||
|
||||
switch (uMsg)
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
SetWindowText(hW, _("PGXP Config"));
|
||||
|
@ -1374,7 +1382,7 @@ BOOL CALLBACK ConfigurePGXPDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
Static_SetText(GetDlgItem(hW, IDC_PGXP_MODETEXT), _("Error: Uknown mode"));
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDCANCEL:
|
||||
|
@ -1423,7 +1431,7 @@ BOOL CALLBACK ConfigurePGXPDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1506,7 +1514,7 @@ BOOL CALLBACK ConfigureCpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
|
||||
if (Config.OverClock)
|
||||
EnableWindow(GetDlgItem(hW, IDC_PSXCLOCK), TRUE);
|
||||
else
|
||||
else
|
||||
EnableWindow(GetDlgItem(hW, IDC_PSXCLOCK), FALSE);
|
||||
break;
|
||||
|
||||
|
@ -1569,6 +1577,10 @@ BOOL CALLBACK ConfigureCpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
else StopDebugger();
|
||||
}
|
||||
|
||||
if (Config.GdbServer) {
|
||||
dbg_start();
|
||||
}
|
||||
|
||||
SaveConfig();
|
||||
|
||||
EndDialog(hW,TRUE);
|
||||
|
@ -1619,7 +1631,7 @@ void Open_Mcd_Proc(HWND hW, int mcd) {
|
|||
memset(&szFilter, 0, sizeof(szFilter));
|
||||
|
||||
strcpy(szFilter, _("Psx Mcd Format (*.mcr;*.mc;*.mem;*.vgs;*.mcd;*.gme;*.ddf)"));
|
||||
str = szFilter + strlen(szFilter) + 1;
|
||||
str = szFilter + strlen(szFilter) + 1;
|
||||
strcpy(str, "*.mcr;*.mcd;*.mem;*.gme;*.mc;*.ddf");
|
||||
|
||||
str+= strlen(str) + 1;
|
||||
|
@ -1725,7 +1737,7 @@ int Open_Iso_Proc(char *file) {
|
|||
ofn.hwndOwner = gApp.hWnd;
|
||||
|
||||
strcpy(szFilter, _("Psx Isos (*.iso;*.mdf;*.img;*.bin;*.cue;*.pbp;*.cbn)"));
|
||||
str = szFilter + strlen(szFilter) + 1;
|
||||
str = szFilter + strlen(szFilter) + 1;
|
||||
strcpy(str, "*.iso;*.mdf;*.img;*.bin;*.cue;*.pbp;*.cbn");
|
||||
|
||||
str += strlen(str) + 1;
|
||||
|
@ -1942,15 +1954,15 @@ void InitLanguages() {
|
|||
}
|
||||
|
||||
char *GetLanguageNext() {
|
||||
if (lFind == INVALID_HANDLE_VALUE)
|
||||
if (lFind == INVALID_HANDLE_VALUE)
|
||||
return NULL;
|
||||
|
||||
for (;;) {
|
||||
if (lFirst == 0) {
|
||||
if (FindNextFile(lFind, &lFindData) == FALSE)
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
lFirst = 0;
|
||||
|
||||
if (!strcmp(lFindData.cFileName, ".") ||
|
||||
|
@ -1992,6 +2004,7 @@ int SysInit() {
|
|||
LoadMcds(Config.Mcd1, Config.Mcd2);
|
||||
|
||||
if (Config.Debug) StartDebugger();
|
||||
else if (Config.GdbServer) dbg_start();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue