Bring up to date with PCSX-R master (97809)
This commit is contained in:
parent
e3df273095
commit
8b4350fee7
4035
data/pcsxr.ui
4035
data/pcsxr.ui
File diff suppressed because it is too large
Load Diff
|
@ -899,6 +899,12 @@ void OnCpu_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) {
|
||||||
sscanf(gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object(builder, "GtkEntry_RewindInterval"))), "%lu", &tmp);
|
sscanf(gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object(builder, "GtkEntry_RewindInterval"))), "%lu", &tmp);
|
||||||
Config.RewindInterval = tmp;
|
Config.RewindInterval = tmp;
|
||||||
|
|
||||||
|
sscanf(gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object(builder, "GtkEntry_AltSpeed1"))), "%lu", &tmp);
|
||||||
|
Config.AltSpeed1 = tmp;
|
||||||
|
|
||||||
|
sscanf(gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object(builder, "GtkEntry_AltSpeed2"))), "%lu", &tmp);
|
||||||
|
Config.AltSpeed2 = tmp;
|
||||||
|
|
||||||
Config.Xa = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Xa")));
|
Config.Xa = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Xa")));
|
||||||
Config.SioIrq = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_SioIrq")));
|
Config.SioIrq = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_SioIrq")));
|
||||||
Config.Mdec = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Mdec")));
|
Config.Mdec = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Mdec")));
|
||||||
|
@ -981,6 +987,14 @@ void OnConf_Cpu() {
|
||||||
// Enabled only if interpreter
|
// Enabled only if interpreter
|
||||||
gtk_widget_set_sensitive(GTK_WIDGET(gtk_builder_get_object(builder, "frame_rew")), Config.Cpu);
|
gtk_widget_set_sensitive(GTK_WIDGET(gtk_builder_get_object(builder, "frame_rew")), Config.Cpu);
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "%u", Config.AltSpeed1);
|
||||||
|
widget = GTK_WIDGET(gtk_builder_get_object(builder, "GtkEntry_AltSpeed1"));
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(widget), buf);
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "%u", Config.AltSpeed2);
|
||||||
|
widget = GTK_WIDGET(gtk_builder_get_object(builder, "GtkEntry_AltSpeed2"));
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(widget), buf);
|
||||||
|
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Xa")), Config.Xa);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Xa")), Config.Xa);
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_SioIrq")), Config.SioIrq);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_SioIrq")), Config.SioIrq);
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Mdec")), Config.Mdec);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Mdec")), Config.Mdec);
|
||||||
|
|
10
gui/Config.c
10
gui/Config.c
|
@ -148,6 +148,13 @@ int LoadConfig(PcsxConfig *Conf) {
|
||||||
Config.RewindCount = GetValuel(data, "RewindCount");
|
Config.RewindCount = GetValuel(data, "RewindCount");
|
||||||
Config.RewindInterval = GetValuel(data, "RewindInterval");
|
Config.RewindInterval = GetValuel(data, "RewindInterval");
|
||||||
|
|
||||||
|
Config.AltSpeed1 = GetValuel(data, "AltSpeed1");
|
||||||
|
if (!Config.AltSpeed1)
|
||||||
|
Config.AltSpeed1 = 50;
|
||||||
|
Config.AltSpeed2 = GetValuel(data, "AltSpeed2");
|
||||||
|
if (!Config.AltSpeed2)
|
||||||
|
Config.AltSpeed2 = 250;
|
||||||
|
|
||||||
Config.HackFix = GetValuel(data, "HackFix");
|
Config.HackFix = GetValuel(data, "HackFix");
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
|
@ -199,6 +206,9 @@ void SaveConfig() {
|
||||||
SetValuel("RewindCount", Config.RewindCount);
|
SetValuel("RewindCount", Config.RewindCount);
|
||||||
SetValuel("RewindInterval", Config.RewindInterval);
|
SetValuel("RewindInterval", Config.RewindInterval);
|
||||||
|
|
||||||
|
SetValuel("AltSpeed1", Config.AltSpeed1);
|
||||||
|
SetValuel("AltSpeed2", Config.AltSpeed2);
|
||||||
|
|
||||||
SetValuel("HackFix", Config.HackFix);
|
SetValuel("HackFix", Config.HackFix);
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
|
@ -229,7 +229,11 @@ gchar* get_state_filename(int i) {
|
||||||
|
|
||||||
trimlabel = get_cdrom_label_trim();
|
trimlabel = get_cdrom_label_trim();
|
||||||
|
|
||||||
sprintf(SStateFile, "%.32s-%.9s.%3.3d", trimlabel, CdromId, i);
|
if (i >= OLD_SLOT && i <= LAST_OLD_SLOT) {
|
||||||
|
sprintf(SStateFile, "%.32s-%.9s.old_%d", trimlabel, CdromId, i - OLD_SLOT);
|
||||||
|
} else {
|
||||||
|
sprintf(SStateFile, "%.32s-%.9s.%3.3d", trimlabel, CdromId, i);
|
||||||
|
}
|
||||||
state_filename = g_build_filename (getenv("HOME"), STATES_DIR, SStateFile, NULL);
|
state_filename = g_build_filename (getenv("HOME"), STATES_DIR, SStateFile, NULL);
|
||||||
|
|
||||||
g_free(trimlabel);
|
g_free(trimlabel);
|
||||||
|
|
|
@ -37,6 +37,10 @@
|
||||||
#define CHEATS_DIR "/.pcsxr/cheats/"
|
#define CHEATS_DIR "/.pcsxr/cheats/"
|
||||||
#define PATCHES_DIR "/.pcsxr/patches/"
|
#define PATCHES_DIR "/.pcsxr/patches/"
|
||||||
|
|
||||||
|
#define OLD_SLOT 1000
|
||||||
|
#define NUM_OLD_SLOTS 2
|
||||||
|
#define LAST_OLD_SLOT (OLD_SLOT + NUM_OLD_SLOTS - 1)
|
||||||
|
|
||||||
extern gboolean UseGui;
|
extern gboolean UseGui;
|
||||||
extern int StatesC;
|
extern int StatesC;
|
||||||
char cfgfile[MAXPATHLEN]; /* ADB Comment this out - make a local var, or at least use gchar funcs */
|
char cfgfile[MAXPATHLEN]; /* ADB Comment this out - make a local var, or at least use gchar funcs */
|
||||||
|
|
|
@ -137,7 +137,7 @@ static gchar* MCDStatusToChar(McdBlock *Info) {
|
||||||
state = _("Link");
|
state = _("Link");
|
||||||
else if (ISLINKENDBLOCK(Info))
|
else if (ISLINKENDBLOCK(Info))
|
||||||
state = _("End link");
|
state = _("End link");
|
||||||
} else
|
} else
|
||||||
state = _("Free");
|
state = _("Free");
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -203,8 +203,20 @@ static void LoadListItems(int mcd, boolean newstore) {
|
||||||
|
|
||||||
if (newstore) gtk_list_store_append(store, &iter);
|
if (newstore) gtk_list_store_append(store, &iter);
|
||||||
|
|
||||||
|
GError *error=NULL;
|
||||||
title = g_convert(Info->sTitle, strlen(Info->sTitle), "UTF-8",
|
title = g_convert(Info->sTitle, strlen(Info->sTitle), "UTF-8",
|
||||||
"Shift-JIS", NULL, NULL, NULL);
|
"Shift-JIS", NULL, NULL, &error);
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
// Some characters caused problems because of custom encoding.
|
||||||
|
// Let's use the ASCII title as fallback.
|
||||||
|
// Otherwise custom decoding from that region
|
||||||
|
// of BIOS needed which is way overkill here.
|
||||||
|
title = g_convert(Info->Title, strlen(Info->Title), "UTF-8",
|
||||||
|
"Shift-JIS", NULL, NULL, NULL);
|
||||||
|
g_clear_error(&error);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_list_store_set(store, &iter,
|
gtk_list_store_set(store, &iter,
|
||||||
CL_ICON, pixbuf,
|
CL_ICON, pixbuf,
|
||||||
|
|
112
gui/Plugin.c
112
gui/Plugin.c
|
@ -42,6 +42,8 @@ extern void LidInterrupt();
|
||||||
unsigned long gpuDisp;
|
unsigned long gpuDisp;
|
||||||
|
|
||||||
int StatesC = 0;
|
int StatesC = 0;
|
||||||
|
unsigned char loadedOld = FALSE;
|
||||||
|
int speed = 100;
|
||||||
extern int UseGui;
|
extern int UseGui;
|
||||||
|
|
||||||
void gpuShowPic() {
|
void gpuShowPic() {
|
||||||
|
@ -77,9 +79,23 @@ void gpuShowPic() {
|
||||||
|
|
||||||
void KeyStateSave(int i) {
|
void KeyStateSave(int i) {
|
||||||
gchar *state_filename;
|
gchar *state_filename;
|
||||||
|
gchar *oldname, *newname;
|
||||||
|
int j;
|
||||||
|
|
||||||
state_filename = get_state_filename (i);
|
state_filename = get_state_filename (i);
|
||||||
|
if (i < OLD_SLOT && !loadedOld) {
|
||||||
|
newname = get_state_filename (LAST_OLD_SLOT);
|
||||||
|
for (j = LAST_OLD_SLOT - 1; j >= OLD_SLOT; --j) {
|
||||||
|
oldname = get_state_filename (j);
|
||||||
|
rename(oldname, newname);
|
||||||
|
g_free (newname);
|
||||||
|
newname = oldname;
|
||||||
|
}
|
||||||
|
rename(state_filename, newname);
|
||||||
|
g_free (newname);
|
||||||
|
}
|
||||||
state_save (state_filename);
|
state_save (state_filename);
|
||||||
|
loadedOld = FALSE;
|
||||||
|
|
||||||
g_free (state_filename);
|
g_free (state_filename);
|
||||||
}
|
}
|
||||||
|
@ -87,6 +103,8 @@ void KeyStateSave(int i) {
|
||||||
void KeyStateLoad(int i) {
|
void KeyStateLoad(int i) {
|
||||||
gchar *state_filename;
|
gchar *state_filename;
|
||||||
|
|
||||||
|
loadedOld = (i >= OLD_SLOT && i <= LAST_OLD_SLOT);
|
||||||
|
|
||||||
state_filename = get_state_filename (i);
|
state_filename = get_state_filename (i);
|
||||||
state_load (state_filename);
|
state_load (state_filename);
|
||||||
|
|
||||||
|
@ -108,6 +126,7 @@ void PADhandleKey(int key) {
|
||||||
char Text[MAXPATHLEN];
|
char Text[MAXPATHLEN];
|
||||||
gchar *state_filename;
|
gchar *state_filename;
|
||||||
time_t now;
|
time_t now;
|
||||||
|
int slot;
|
||||||
|
|
||||||
short rel = 0; //released key flag
|
short rel = 0; //released key flag
|
||||||
|
|
||||||
|
@ -155,69 +174,20 @@ void PADhandleKey(int key) {
|
||||||
if (modalt) KeyStateLoad(10);
|
if (modalt) KeyStateLoad(10);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XK_1:
|
case XK_1: case XK_2: case XK_3: case XK_4: case XK_5:
|
||||||
|
case XK_6: case XK_7: case XK_8: case XK_9:
|
||||||
|
slot = key - XK_1;
|
||||||
if (modalt && modctrl)
|
if (modalt && modctrl)
|
||||||
return;
|
return;
|
||||||
if (modalt) KeyStateLoad(0);
|
if (modalt) KeyStateLoad(slot);
|
||||||
if (modctrl) KeyStateSave(0);
|
else if (modctrl) KeyStateSave(slot);
|
||||||
break;
|
else KeyStateLoad(OLD_SLOT + slot);
|
||||||
case XK_2:
|
|
||||||
if (modalt && modctrl)
|
|
||||||
return;
|
|
||||||
if (modalt) KeyStateLoad(1);
|
|
||||||
if (modctrl) KeyStateSave(1);
|
|
||||||
break;
|
|
||||||
case XK_3:
|
|
||||||
if (modalt && modctrl)
|
|
||||||
return;
|
|
||||||
if (modalt) KeyStateLoad(2);
|
|
||||||
if (modctrl) KeyStateSave(2);
|
|
||||||
break;
|
|
||||||
case XK_4:
|
|
||||||
if (modalt && modctrl)
|
|
||||||
return;
|
|
||||||
if (modalt) KeyStateLoad(3);
|
|
||||||
if (modctrl) KeyStateSave(3);
|
|
||||||
break;
|
|
||||||
case XK_5:
|
|
||||||
if (modalt && modctrl)
|
|
||||||
return;
|
|
||||||
if (modalt) KeyStateLoad(4);
|
|
||||||
if (modctrl) KeyStateSave(4);
|
|
||||||
break;
|
|
||||||
case XK_6:
|
|
||||||
if (modalt && modctrl)
|
|
||||||
return;
|
|
||||||
if (modalt) KeyStateLoad(5);
|
|
||||||
if (modctrl) KeyStateSave(5);
|
|
||||||
break;
|
|
||||||
case XK_7:
|
|
||||||
if (modalt && modctrl)
|
|
||||||
return;
|
|
||||||
if (modalt) KeyStateLoad(6);
|
|
||||||
if (modctrl) KeyStateSave(6);
|
|
||||||
break;
|
|
||||||
case XK_8:
|
|
||||||
if (modalt && modctrl)
|
|
||||||
return;
|
|
||||||
if (modalt) KeyStateLoad(7);
|
|
||||||
if (modctrl) KeyStateSave(7);
|
|
||||||
break;
|
|
||||||
case XK_9:
|
|
||||||
if (modalt && modctrl)
|
|
||||||
return;
|
|
||||||
if (modalt) KeyStateLoad(8);
|
|
||||||
if (modctrl) KeyStateSave(8);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XK_F1:
|
case XK_F1:
|
||||||
GPU_freeze(2, (GPUFreeze_t *)&StatesC);
|
GPU_freeze(2, (GPUFreeze_t *)&StatesC);
|
||||||
state_filename = get_state_filename (StatesC);
|
KeyStateSave(StatesC);
|
||||||
state_save (state_filename);
|
|
||||||
|
|
||||||
g_free (state_filename);
|
|
||||||
gpuShowPic();
|
gpuShowPic();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case XK_F2:
|
case XK_F2:
|
||||||
if (StatesC < (MAX_SLOTS - 1)) StatesC++;
|
if (StatesC < (MAX_SLOTS - 1)) StatesC++;
|
||||||
|
@ -226,15 +196,7 @@ void PADhandleKey(int key) {
|
||||||
gpuShowPic();
|
gpuShowPic();
|
||||||
break;
|
break;
|
||||||
case XK_F3:
|
case XK_F3:
|
||||||
state_filename = get_state_filename (StatesC);
|
KeyStateLoad(StatesC);
|
||||||
state_load (state_filename);
|
|
||||||
|
|
||||||
g_free (state_filename);
|
|
||||||
|
|
||||||
// HACKHACK: prevent crash when using recompiler due to execution not
|
|
||||||
// returned from compiled code. This WILL cause memory leak, however a
|
|
||||||
// large amount of refactor is needed for a proper fix.
|
|
||||||
if (Config.Cpu == CPU_DYNAREC) psxCpu->Execute();
|
|
||||||
gpuShowPic();
|
gpuShowPic();
|
||||||
break;
|
break;
|
||||||
case XK_F4:
|
case XK_F4:
|
||||||
|
@ -290,6 +252,22 @@ void PADhandleKey(int key) {
|
||||||
tslastpressed = now;
|
tslastpressed = now;
|
||||||
RewindState();
|
RewindState();
|
||||||
break;
|
break;
|
||||||
|
case XK_bracketleft:
|
||||||
|
if (speed == Config.AltSpeed1) {
|
||||||
|
speed = 100;
|
||||||
|
} else {
|
||||||
|
speed = Config.AltSpeed1;
|
||||||
|
}
|
||||||
|
GPU_setSpeed(speed / 100.0);
|
||||||
|
break;
|
||||||
|
case XK_bracketright:
|
||||||
|
if (speed == Config.AltSpeed2) {
|
||||||
|
speed = 100;
|
||||||
|
} else {
|
||||||
|
speed = Config.AltSpeed2;
|
||||||
|
}
|
||||||
|
GPU_setSpeed(speed / 100.0);
|
||||||
|
break;
|
||||||
case XK_Escape:
|
case XK_Escape:
|
||||||
// TODO
|
// TODO
|
||||||
// the architecture is too broken to actually restart the GUI
|
// the architecture is too broken to actually restart the GUI
|
||||||
|
@ -298,8 +276,10 @@ void PADhandleKey(int key) {
|
||||||
// Fixing this would probably require a complete reworking of
|
// Fixing this would probably require a complete reworking of
|
||||||
// all functions, so that they return 0 or 1 for success
|
// all functions, so that they return 0 or 1 for success
|
||||||
// that way, execution wouldn't continue
|
// that way, execution wouldn't continue
|
||||||
if (CdromId[0] != '\0')
|
if (CdromId[0] != '\0') {
|
||||||
|
loadedOld = TRUE;
|
||||||
KeyStateSave(10);
|
KeyStateSave(10);
|
||||||
|
}
|
||||||
ClosePlugins();
|
ClosePlugins();
|
||||||
UpdateMenuSlots();
|
UpdateMenuSlots();
|
||||||
if (!UseGui) OnFile_Exit();
|
if (!UseGui) OnFile_Exit();
|
||||||
|
|
|
@ -1328,7 +1328,7 @@ void cdrWrite1(unsigned char rt) {
|
||||||
set_loc[i] = btoi(cdr.Param[i]);
|
set_loc[i] = btoi(cdr.Param[i]);
|
||||||
|
|
||||||
i = msf2sec(cdr.SetSectorPlay);
|
i = msf2sec(cdr.SetSectorPlay);
|
||||||
i = abs(i - msf2sec(set_loc));
|
i = abs(i - (int)msf2sec(set_loc));
|
||||||
if (i > 16)
|
if (i > 16)
|
||||||
cdr.Seeked = SEEK_PENDING;
|
cdr.Seeked = SEEK_PENDING;
|
||||||
|
|
||||||
|
|
|
@ -418,6 +418,8 @@ static int recInit() {
|
||||||
|
|
||||||
for (i = 0; i < 0x08; i++) psxRecLUT[i + 0xbfc0] = (u32)&recROM[i << 16];
|
for (i = 0; i < 0x08; i++) psxRecLUT[i + 0xbfc0] = (u32)&recROM[i << 16];
|
||||||
|
|
||||||
|
x86Init();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,8 +427,6 @@ static void recReset() {
|
||||||
memset(recRAM, 0, 0x200000);
|
memset(recRAM, 0, 0x200000);
|
||||||
memset(recROM, 0, 0x080000);
|
memset(recROM, 0, 0x080000);
|
||||||
|
|
||||||
x86Init();
|
|
||||||
|
|
||||||
x86SetPtr(recMem);
|
x86SetPtr(recMem);
|
||||||
|
|
||||||
branch = 0;
|
branch = 0;
|
||||||
|
|
|
@ -482,6 +482,9 @@ static int recInit() {
|
||||||
|
|
||||||
for (i=0; i<0x08; i++) psxRecLUT[i + 0xbfc0] = (uptr)&recROM[PTRMULT*(i << 16)];
|
for (i=0; i<0x08; i++) psxRecLUT[i + 0xbfc0] = (uptr)&recROM[PTRMULT*(i << 16)];
|
||||||
|
|
||||||
|
//x86Init();
|
||||||
|
cpudetectInit();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,8 +492,6 @@ static void recReset() {
|
||||||
memset(recRAM, 0, 0x200000 * PTRMULT);
|
memset(recRAM, 0, 0x200000 * PTRMULT);
|
||||||
memset(recROM, 0, 0x080000 * PTRMULT);
|
memset(recROM, 0, 0x080000 * PTRMULT);
|
||||||
|
|
||||||
//x86Init();
|
|
||||||
cpudetectInit();
|
|
||||||
x86SetPtr(recMem);
|
x86SetPtr(recMem);
|
||||||
|
|
||||||
branch = 0;
|
branch = 0;
|
||||||
|
|
|
@ -229,8 +229,17 @@ int LoadCdromFile(const char *filename, EXE_HEADER *head) {
|
||||||
u8 time[4],*buf;
|
u8 time[4],*buf;
|
||||||
u8 mdir[4096], exename[256];
|
u8 mdir[4096], exename[256];
|
||||||
u32 size, addr;
|
u32 size, addr;
|
||||||
|
void *psxaddr;
|
||||||
|
|
||||||
sscanf(filename, "cdrom:\\%255s", exename);
|
if (sscanf(filename, "cdrom:\\%255s", exename) <= 0)
|
||||||
|
{
|
||||||
|
// Some games omit backslash (NFS4)
|
||||||
|
if (sscanf(filename, "cdrom:%255s", exename) <= 0)
|
||||||
|
{
|
||||||
|
SysPrintf("LoadCdromFile: EXE NAME PARSING ERROR (%s (%u))\n", filename, strlen(filename));
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
time[0] = itob(0); time[1] = itob(2); time[2] = itob(0x10);
|
time[0] = itob(0); time[1] = itob(2); time[2] = itob(0x10);
|
||||||
|
|
||||||
|
@ -259,7 +268,9 @@ int LoadCdromFile(const char *filename, EXE_HEADER *head) {
|
||||||
incTime();
|
incTime();
|
||||||
READTRACK();
|
READTRACK();
|
||||||
|
|
||||||
memcpy((void *)PSXM(addr), buf + 12, 2048);
|
psxaddr = (void *)PSXM(addr);
|
||||||
|
assert(psxaddr != NULL);
|
||||||
|
memcpy(psxaddr, buf + 12, 2048);
|
||||||
|
|
||||||
size -= 2048;
|
size -= 2048;
|
||||||
addr += 2048;
|
addr += 2048;
|
||||||
|
@ -360,13 +371,15 @@ int CheckCdrom() {
|
||||||
|
|
||||||
static int PSXGetFileType(FILE *f) {
|
static int PSXGetFileType(FILE *f) {
|
||||||
unsigned long current;
|
unsigned long current;
|
||||||
u8 mybuf[2048];
|
u8 mybuf[sizeof(EXE_HEADER)]; // EXE_HEADER currently biggest
|
||||||
EXE_HEADER *exe_hdr;
|
EXE_HEADER *exe_hdr;
|
||||||
FILHDR *coff_hdr;
|
FILHDR *coff_hdr;
|
||||||
|
size_t amt;
|
||||||
|
|
||||||
|
memset(mybuf, 0, sizeof(mybuf));
|
||||||
current = ftell(f);
|
current = ftell(f);
|
||||||
fseek(f, 0L, SEEK_SET);
|
fseek(f, 0L, SEEK_SET);
|
||||||
fread(mybuf, 2048, 1, f);
|
amt = fread(mybuf, sizeof(mybuf), 1, f);
|
||||||
fseek(f, current, SEEK_SET);
|
fseek(f, current, SEEK_SET);
|
||||||
|
|
||||||
exe_hdr = (EXE_HEADER *)mybuf;
|
exe_hdr = (EXE_HEADER *)mybuf;
|
||||||
|
@ -408,6 +421,7 @@ int Load(const char *ExePath) {
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
u8 opcode;
|
u8 opcode;
|
||||||
u32 section_address, section_size;
|
u32 section_address, section_size;
|
||||||
|
void* psxmaddr;
|
||||||
|
|
||||||
strncpy(CdromId, "SLUS99999", 9);
|
strncpy(CdromId, "SLUS99999", 9);
|
||||||
strncpy(CdromLabel, "SLUS_999.99", 11);
|
strncpy(CdromLabel, "SLUS_999.99", 11);
|
||||||
|
@ -479,7 +493,9 @@ int Load(const char *ExePath) {
|
||||||
fseek(tmpFile, SWAP32(section.s_scnptr), SEEK_SET);
|
fseek(tmpFile, SWAP32(section.s_scnptr), SEEK_SET);
|
||||||
fread(PSXM(SWAP32(section.s_paddr)), SWAP32(section.s_size), 1, tmpFile);
|
fread(PSXM(SWAP32(section.s_paddr)), SWAP32(section.s_size), 1, tmpFile);
|
||||||
} else {
|
} else {
|
||||||
memset(PSXM(SWAP32(section.s_paddr)), 0, SWAP32(section.s_size));
|
psxmaddr = PSXM(SWAP32(section.s_paddr));
|
||||||
|
assert(psxmaddr != NULL);
|
||||||
|
memset(psxmaddr, 0, SWAP32(section.s_size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -54,6 +54,7 @@ GPUvBlank GPU_vBlank;
|
||||||
GPUvisualVibration GPU_visualVibration;
|
GPUvisualVibration GPU_visualVibration;
|
||||||
GPUcursor GPU_cursor;
|
GPUcursor GPU_cursor;
|
||||||
GPUaddVertex GPU_addVertex;
|
GPUaddVertex GPU_addVertex;
|
||||||
|
GPUsetSpeed GPU_setSpeed;
|
||||||
GPUpgxpMemory GPU_pgxpMemory;
|
GPUpgxpMemory GPU_pgxpMemory;
|
||||||
|
|
||||||
CDRinit CDR_init;
|
CDRinit CDR_init;
|
||||||
|
@ -215,6 +216,7 @@ void CALLBACK GPU__vBlank(int val) {}
|
||||||
void CALLBACK GPU__visualVibration(unsigned long iSmall, unsigned long iBig) {}
|
void CALLBACK GPU__visualVibration(unsigned long iSmall, unsigned long iBig) {}
|
||||||
void CALLBACK GPU__cursor(int player, int x, int y) {}
|
void CALLBACK GPU__cursor(int player, int x, int y) {}
|
||||||
void CALLBACK GPU__addVertex(short sx,short sy,s64 fx,s64 fy,s64 fz) {}
|
void CALLBACK GPU__addVertex(short sx,short sy,s64 fx,s64 fy,s64 fz) {}
|
||||||
|
void CALLBACK GPU__setSpeed(float newSpeed) {}
|
||||||
void CALLBACK GPU__pgxpMemory(unsigned char* pMem, unsigned int count, unsigned int addr, unsigned char* pVRAM) {}
|
void CALLBACK GPU__pgxpMemory(unsigned char* pMem, unsigned int count, unsigned int addr, unsigned char* pVRAM) {}
|
||||||
|
|
||||||
#define LoadGpuSym1(dest, name) \
|
#define LoadGpuSym1(dest, name) \
|
||||||
|
@ -261,6 +263,7 @@ static int LoadGPUplugin(const char *GPUdll) {
|
||||||
LoadGpuSym0(visualVibration, "GPUvisualVibration");
|
LoadGpuSym0(visualVibration, "GPUvisualVibration");
|
||||||
LoadGpuSym0(cursor, "GPUcursor");
|
LoadGpuSym0(cursor, "GPUcursor");
|
||||||
LoadGpuSym0(addVertex, "GPUaddVertex");
|
LoadGpuSym0(addVertex, "GPUaddVertex");
|
||||||
|
LoadGpuSym0(setSpeed, "GPUsetSpeed");
|
||||||
LoadGpuSym0(pgxpMemory, "GPUpgxpMemory");
|
LoadGpuSym0(pgxpMemory, "GPUpgxpMemory");
|
||||||
LoadGpuSym0(configure, "GPUconfigure");
|
LoadGpuSym0(configure, "GPUconfigure");
|
||||||
LoadGpuSym0(test, "GPUtest");
|
LoadGpuSym0(test, "GPUtest");
|
||||||
|
|
|
@ -96,6 +96,7 @@ typedef void (CALLBACK* GPUvBlank)(int);
|
||||||
typedef void (CALLBACK* GPUvisualVibration)(uint32_t, uint32_t);
|
typedef void (CALLBACK* GPUvisualVibration)(uint32_t, uint32_t);
|
||||||
typedef void (CALLBACK* GPUcursor)(int, int, int);
|
typedef void (CALLBACK* GPUcursor)(int, int, int);
|
||||||
typedef void (CALLBACK* GPUaddVertex)(short,short,s64,s64,s64);
|
typedef void (CALLBACK* GPUaddVertex)(short,short,s64,s64,s64);
|
||||||
|
typedef void (CALLBACK* GPUsetSpeed)(float); // 1.0 = natural speed
|
||||||
typedef void (CALLBACK* GPUpgxpMemory)(unsigned int, unsigned char*);
|
typedef void (CALLBACK* GPUpgxpMemory)(unsigned int, unsigned char*);
|
||||||
|
|
||||||
// GPU function pointers
|
// GPU function pointers
|
||||||
|
@ -126,6 +127,7 @@ extern GPUvBlank GPU_vBlank;
|
||||||
extern GPUvisualVibration GPU_visualVibration;
|
extern GPUvisualVibration GPU_visualVibration;
|
||||||
extern GPUcursor GPU_cursor;
|
extern GPUcursor GPU_cursor;
|
||||||
extern GPUaddVertex GPU_addVertex;
|
extern GPUaddVertex GPU_addVertex;
|
||||||
|
extern GPUsetSpeed GPU_setSpeed;
|
||||||
extern GPUpgxpMemory GPU_pgxpMemory;
|
extern GPUpgxpMemory GPU_pgxpMemory;
|
||||||
|
|
||||||
// CD-ROM Functions
|
// CD-ROM Functions
|
||||||
|
|
|
@ -165,12 +165,21 @@ char *biosC0n[256] = {
|
||||||
#define ra (psxRegs.GPR.n.ra)
|
#define ra (psxRegs.GPR.n.ra)
|
||||||
#define pc0 (psxRegs.pc)
|
#define pc0 (psxRegs.pc)
|
||||||
|
|
||||||
|
#ifdef __NO_ASSERTS__
|
||||||
#define Ra0 ((char *)PSXM(a0))
|
#define Ra0 ((char *)PSXM(a0))
|
||||||
#define Ra1 ((char *)PSXM(a1))
|
#define Ra1 ((char *)PSXM(a1))
|
||||||
#define Ra2 ((char *)PSXM(a2))
|
#define Ra2 ((char *)PSXM(a2))
|
||||||
#define Ra3 ((char *)PSXM(a3))
|
#define Ra3 ((char *)PSXM(a3))
|
||||||
#define Rv0 ((char *)PSXM(v0))
|
#define Rv0 ((char *)PSXM(v0))
|
||||||
#define Rsp ((char *)PSXM(sp))
|
#define Rsp ((char *)PSXM(sp))
|
||||||
|
#else
|
||||||
|
#define Ra0 (assert(PSXM(a0) != NULL), (char *)PSXM(a0))
|
||||||
|
#define Ra1 (assert(PSXM(a1) != NULL), (char *)PSXM(a1))
|
||||||
|
#define Ra2 (assert(PSXM(a2) != NULL), (char *)PSXM(a2))
|
||||||
|
#define Ra3 (assert(PSXM(a3) != NULL), (char *)PSXM(a3))
|
||||||
|
#define Rv0 (assert(PSXM(v0) != NULL), (char *)PSXM(v0))
|
||||||
|
#define Rsp (assert(PSXM(sp) != NULL), (char *)PSXM(sp))
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 desc;
|
u32 desc;
|
||||||
|
@ -655,7 +664,7 @@ void psxBios_memset() { // 0x2b
|
||||||
while((s32)a2 > 0)
|
while((s32)a2 > 0)
|
||||||
{
|
{
|
||||||
a2--;
|
a2--;
|
||||||
psxMu8ref(a0) = a1;
|
*PSXM(a0) = a1;
|
||||||
a0++;
|
a0++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -964,7 +973,7 @@ void psxBios_printf() { // 0x3f
|
||||||
char *ptmp = tmp;
|
char *ptmp = tmp;
|
||||||
int n=1, i=0, j;
|
int n=1, i=0, j;
|
||||||
|
|
||||||
memcpy(save, (char*)PSXM(sp), 4 * 4);
|
memcpy(save, Rsp, 4 * 4);
|
||||||
psxMu32ref(sp) = SWAP32((u32)a0);
|
psxMu32ref(sp) = SWAP32((u32)a0);
|
||||||
psxMu32ref(sp + 4) = SWAP32((u32)a1);
|
psxMu32ref(sp + 4) = SWAP32((u32)a1);
|
||||||
psxMu32ref(sp + 8) = SWAP32((u32)a2);
|
psxMu32ref(sp + 8) = SWAP32((u32)a2);
|
||||||
|
@ -1018,7 +1027,7 @@ _start:
|
||||||
}
|
}
|
||||||
*ptmp = 0;
|
*ptmp = 0;
|
||||||
|
|
||||||
memcpy((char*)PSXM(sp), save, 4 * 4);
|
memcpy(Rsp, save, 4 * 4);
|
||||||
|
|
||||||
#ifdef PSXBIOS_LOG
|
#ifdef PSXBIOS_LOG
|
||||||
PSXBIOS_LOG("psxBios_%s: %s\n", biosA0n[0x3f], tmp);
|
PSXBIOS_LOG("psxBios_%s: %s\n", biosA0n[0x3f], tmp);
|
||||||
|
@ -1273,16 +1282,34 @@ void psxBios_SetMem() { // 9f
|
||||||
}
|
}
|
||||||
|
|
||||||
void psxBios__card_info() { // ab
|
void psxBios__card_info() { // ab
|
||||||
// COTS password option
|
u32 ret;
|
||||||
boolean nocard = (Config.NoMemcard || ((strlen(Config.Mcd1) <=0) && (strlen(Config.Mcd2) <=0)));
|
|
||||||
#ifdef PSXBIOS_LOG
|
#ifdef PSXBIOS_LOG
|
||||||
PSXBIOS_LOG("psxBios_%s: %x\n", biosA0n[0xab], a0);
|
PSXBIOS_LOG("psxBios_%s: 0x%x\n", biosA0n[0xab], a0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
card_active_chan = a0;
|
card_active_chan = a0;
|
||||||
|
|
||||||
|
switch (card_active_chan) {
|
||||||
|
case 0x00: case 0x01: case 0x02: case 0x03:
|
||||||
|
ret = Config.Mcd1[0] ? 0x2 : 0x8;
|
||||||
|
break;
|
||||||
|
case 0x10: case 0x11: case 0x12: case 0x13:
|
||||||
|
ret = Config.Mcd2[0] ? 0x2 : 0x8;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
#ifdef PSXBIOS_LOG
|
||||||
|
PSXBIOS_LOG("psxBios_%s: UNKNOWN PORT 0x%x\n", biosA0n[0xab], card_active_chan);
|
||||||
|
#endif
|
||||||
|
ret = 0x11;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// COTS password option
|
||||||
|
if (Config.NoMemcard)
|
||||||
|
ret = 0x8;
|
||||||
|
|
||||||
// DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004
|
// DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004
|
||||||
DeliverEvent(0x81, nocard ? 0x8 : 0x2); // 0xf4000001, 0x0004
|
DeliverEvent(0x81, ret); // 0xf4000001, 0x0004
|
||||||
|
|
||||||
v0 = 1; pc0 = ra;
|
v0 = 1; pc0 = ra;
|
||||||
}
|
}
|
||||||
|
@ -1673,43 +1700,68 @@ void psxBios_UnDeliverEvent() { // 0x20
|
||||||
pc0 = ra;
|
pc0 = ra;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define buopen(mcd) { \
|
static void buopen(int mcd, u8 *ptr, u8 *cfg)
|
||||||
strcpy(FDesc[1 + mcd].name, Ra0+5); \
|
{
|
||||||
FDesc[1 + mcd].offset = 0; \
|
int i;
|
||||||
FDesc[1 + mcd].mode = a1; \
|
u8 *fptr = ptr;
|
||||||
\
|
|
||||||
for (i=1; i<16; i++) { \
|
strcpy(FDesc[1 + mcd].name, Ra0+5);
|
||||||
ptr = Mcd##mcd##Data + 128 * i; \
|
FDesc[1 + mcd].offset = 0;
|
||||||
if ((*ptr & 0xF0) != 0x50) continue; \
|
FDesc[1 + mcd].mode = a1;
|
||||||
if (strcmp(FDesc[1 + mcd].name, ptr+0xa)) continue; \
|
|
||||||
FDesc[1 + mcd].mcfile = i; \
|
for (i=1; i<16; i++) {
|
||||||
SysPrintf("open %s\n", ptr+0xa); \
|
fptr += 128;
|
||||||
v0 = 1 + mcd; \
|
if ((*fptr & 0xF0) != 0x50) continue;
|
||||||
break; \
|
if (strcmp(FDesc[1 + mcd].name, fptr+0xa)) continue;
|
||||||
} \
|
FDesc[1 + mcd].mcfile = i;
|
||||||
if (a1 & 0x200 && v0 == -1) { /* FCREAT */ \
|
SysPrintf("open %s\n", fptr+0xa);
|
||||||
for (i=1; i<16; i++) { \
|
v0 = 1 + mcd;
|
||||||
int j, xor = 0; \
|
break;
|
||||||
\
|
}
|
||||||
ptr = Mcd##mcd##Data + 128 * i; \
|
if (a1 & 0x200 && v0 == -1) { /* FCREAT */
|
||||||
if ((*ptr & 0xF0) == 0x50) continue; \
|
fptr = ptr;
|
||||||
ptr[0] = 0x50 | (u8)(a1 >> 16); \
|
for (i=1; i<16; i++) {
|
||||||
ptr[4] = 0x00; \
|
int j, xor, nblk = a1 >> 16;
|
||||||
ptr[5] = 0x20; \
|
u8 *pptr, *fptr2;
|
||||||
ptr[6] = 0x00; \
|
|
||||||
ptr[7] = 0x00; \
|
fptr += 128;
|
||||||
ptr[8] = 'B'; \
|
if ((*fptr & 0xF0) != 0xa0) continue;
|
||||||
ptr[9] = 'I'; \
|
|
||||||
strcpy(ptr+0xa, FDesc[1 + mcd].name); \
|
FDesc[1 + mcd].mcfile = i;
|
||||||
for (j=0; j<127; j++) xor^= ptr[j]; \
|
fptr[0] = 0x51;
|
||||||
ptr[127] = xor; \
|
fptr[4] = 0x00;
|
||||||
FDesc[1 + mcd].mcfile = i; \
|
fptr[5] = 0x20 * nblk;
|
||||||
SysPrintf("openC %s\n", ptr); \
|
fptr[6] = 0x00;
|
||||||
v0 = 1 + mcd; \
|
fptr[7] = 0x00;
|
||||||
SaveMcd(Config.Mcd##mcd, Mcd##mcd##Data, 128 * i, 128); \
|
strcpy(fptr+0xa, FDesc[1 + mcd].name);
|
||||||
break; \
|
pptr = fptr2 = fptr;
|
||||||
} \
|
for(j=2; j<=nblk; j++) {
|
||||||
} \
|
int k;
|
||||||
|
for(i++; i<16; i++) {
|
||||||
|
fptr2 += 128;
|
||||||
|
|
||||||
|
memset(fptr2, 0, 128);
|
||||||
|
fptr2[0] = j < nblk ? 0x52 : 0x53;
|
||||||
|
pptr[8] = i - 1;
|
||||||
|
pptr[9] = 0;
|
||||||
|
for (k=0, xor=0; k<127; k++) xor^= pptr[k];
|
||||||
|
pptr[127] = xor;
|
||||||
|
pptr = fptr2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* shouldn't this return ENOSPC if i == 16? */
|
||||||
|
}
|
||||||
|
pptr[8] = pptr[9] = 0xff;
|
||||||
|
for (j=0, xor=0; j<127; j++) xor^= pptr[j];
|
||||||
|
pptr[127] = xor;
|
||||||
|
SysPrintf("openC %s %d\n", ptr, nblk);
|
||||||
|
v0 = 1 + mcd;
|
||||||
|
/* just go ahead and resave them all */
|
||||||
|
SaveMcd(cfg, ptr, 128, 128 * 15);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* shouldn't this return ENOSPC if i == 16? */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1717,8 +1769,7 @@ void psxBios_UnDeliverEvent() { // 0x20
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void psxBios_open() { // 0x32
|
void psxBios_open() { // 0x32
|
||||||
int i;
|
|
||||||
char *ptr;
|
|
||||||
|
|
||||||
#ifdef PSXBIOS_LOG
|
#ifdef PSXBIOS_LOG
|
||||||
PSXBIOS_LOG("psxBios_%s: %s,%x\n", biosB0n[0x32], Ra0, a1);
|
PSXBIOS_LOG("psxBios_%s: %s,%x\n", biosB0n[0x32], Ra0, a1);
|
||||||
|
@ -1727,11 +1778,11 @@ void psxBios_open() { // 0x32
|
||||||
v0 = -1;
|
v0 = -1;
|
||||||
|
|
||||||
if (!strncmp(Ra0, "bu00", 4)) {
|
if (!strncmp(Ra0, "bu00", 4)) {
|
||||||
buopen(1);
|
buopen(1, Mcd1Data, Config.Mcd1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strncmp(Ra0, "bu10", 4)) {
|
if (!strncmp(Ra0, "bu10", 4)) {
|
||||||
buopen(2);
|
buopen(2, Mcd2Data, Config.Mcd2);
|
||||||
}
|
}
|
||||||
|
|
||||||
pc0 = ra;
|
pc0 = ra;
|
||||||
|
@ -1770,7 +1821,7 @@ void psxBios_lseek() { // 0x33
|
||||||
if (FDesc[1 + mcd].mode & 0x8000) v0 = 0; \
|
if (FDesc[1 + mcd].mode & 0x8000) v0 = 0; \
|
||||||
else v0 = a2; \
|
else v0 = a2; \
|
||||||
FDesc[1 + mcd].offset += v0; \
|
FDesc[1 + mcd].offset += v0; \
|
||||||
DeliverEvent(0x11, 0x2); /* 0xf0000011, 0x0004 */ \
|
DeliverEvent(0x11, 0x2); /* 0xf0000011, 0x0004 */ \
|
||||||
DeliverEvent(0x81, 0x2); /* 0xf4000001, 0x0004 */ \
|
DeliverEvent(0x81, 0x2); /* 0xf4000001, 0x0004 */ \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1791,7 +1842,7 @@ void psxBios_read() { // 0x34
|
||||||
case 2: buread(1); break;
|
case 2: buread(1); break;
|
||||||
case 3: buread(2); break;
|
case 3: buread(2); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pc0 = ra;
|
pc0 = ra;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1804,7 +1855,7 @@ void psxBios_read() { // 0x34
|
||||||
SaveMcd(Config.Mcd##mcd, Mcd##mcd##Data, offset, a2); \
|
SaveMcd(Config.Mcd##mcd, Mcd##mcd##Data, offset, a2); \
|
||||||
if (FDesc[1 + mcd].mode & 0x8000) v0 = 0; \
|
if (FDesc[1 + mcd].mode & 0x8000) v0 = 0; \
|
||||||
else v0 = a2; \
|
else v0 = a2; \
|
||||||
DeliverEvent(0x11, 0x2); /* 0xf0000011, 0x0004 */ \
|
DeliverEvent(0x11, 0x2); /* 0xf0000011, 0x0004 */ \
|
||||||
DeliverEvent(0x81, 0x2); /* 0xf4000001, 0x0004 */ \
|
DeliverEvent(0x81, 0x2); /* 0xf4000001, 0x0004 */ \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1855,21 +1906,21 @@ char psxstrbuf[PSXSTRBUFMAX+1];
|
||||||
unsigned short psxstrbuf_count = 0;
|
unsigned short psxstrbuf_count = 0;
|
||||||
|
|
||||||
void psxBios_putchar() { // 3d
|
void psxBios_putchar() { // 3d
|
||||||
char logchar = ( a0 == 0xa ? '>' : (char)a0 );
|
char logchar = ( a0 == 0xa ? '>' : (char)a0 );
|
||||||
if (psxstrbuf_count < PSXSTRBUFMAX) psxstrbuf[psxstrbuf_count++] = logchar;
|
if (psxstrbuf_count < PSXSTRBUFMAX) psxstrbuf[psxstrbuf_count++] = logchar;
|
||||||
|
|
||||||
#ifdef PSXBIOS_LOG
|
#ifdef PSXBIOS_LOG
|
||||||
PSXBIOS_LOG("psxBios_%s: %x (%c)\n", biosB0n[0x3d], a0, logchar);
|
PSXBIOS_LOG("psxBios_%s: %x (%c)\n", biosB0n[0x3d], a0, logchar);
|
||||||
#else
|
#else
|
||||||
SysPrintf("%c", (char)a0);
|
SysPrintf("%c", (char)a0);
|
||||||
#endif
|
#endif
|
||||||
if ((a0 == 0xa && psxstrbuf_count >= 2) || psxstrbuf_count >= PSXSTRBUFMAX) {
|
if ((a0 == 0xa && psxstrbuf_count >= 2) || psxstrbuf_count >= PSXSTRBUFMAX) {
|
||||||
psxstrbuf[psxstrbuf_count++] = '\0';
|
psxstrbuf[psxstrbuf_count++] = '\0';
|
||||||
#ifdef PSXBIOS_LOG
|
#ifdef PSXBIOS_LOG
|
||||||
PSXBIOS_LOG("psxBios_%s: string_[%d]_cr: %s\n", biosB0n[0x3d], psxstrbuf_count, psxstrbuf);
|
PSXBIOS_LOG("psxBios_%s: string_[%d]_cr: %s\n", biosB0n[0x3d], psxstrbuf_count, psxstrbuf);
|
||||||
#endif
|
#endif
|
||||||
psxstrbuf_count = 0;
|
psxstrbuf_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pc0 = ra;
|
pc0 = ra;
|
||||||
}
|
}
|
||||||
|
@ -1890,17 +1941,18 @@ int nfile;
|
||||||
while (nfile < 16) { \
|
while (nfile < 16) { \
|
||||||
int match=1; \
|
int match=1; \
|
||||||
\
|
\
|
||||||
ptr = Mcd##mcd##Data + 128 * nfile; \
|
ptr = Mcd##mcd##Data + 128 * (nfile + 1); \
|
||||||
nfile++; \
|
nfile++; \
|
||||||
if ((*ptr & 0xF0) != 0x50) continue; \
|
if ((*ptr & 0xF0) != 0x50) continue; \
|
||||||
|
/* Bug link files show up as free block. */ \
|
||||||
|
if (!ptr[0xa]) continue; \
|
||||||
ptr+= 0xa; \
|
ptr+= 0xa; \
|
||||||
if (pfile[0] == 0) { \
|
if (pfile[0] == 0) { \
|
||||||
strncpy(dir->name, ptr, sizeof(dir->name)); \
|
strncpy(dir->name, ptr, sizeof(dir->name)); \
|
||||||
dir->name[sizeof(dir->name) - 1] = '\0'; \
|
dir->name[sizeof(dir->name)] = '\0'; \
|
||||||
} else for (i=0; i<20; i++) { \
|
} else for (i=0; i<20; i++) { \
|
||||||
if (pfile[i] == ptr[i]) { \
|
if (pfile[i] == ptr[i]) { \
|
||||||
dir->name[i] = ptr[i]; \
|
dir->name[i] = ptr[i]; continue; } \
|
||||||
if (ptr[i] == 0) break; else continue; } \
|
|
||||||
if (pfile[i] == '?') { \
|
if (pfile[i] == '?') { \
|
||||||
dir->name[i] = ptr[i]; continue; } \
|
dir->name[i] = ptr[i]; continue; } \
|
||||||
if (pfile[i] == '*') { \
|
if (pfile[i] == '*') { \
|
||||||
|
@ -1908,7 +1960,7 @@ int nfile;
|
||||||
match = 0; break; \
|
match = 0; break; \
|
||||||
} \
|
} \
|
||||||
SysPrintf("%d : %s = %s + %s (match=%d)\n", nfile, dir->name, pfile, ptr, match); \
|
SysPrintf("%d : %s = %s + %s (match=%d)\n", nfile, dir->name, pfile, ptr, match); \
|
||||||
if (match == 0) continue; \
|
if (match == 0) { continue; } \
|
||||||
dir->size = 8192; \
|
dir->size = 8192; \
|
||||||
v0 = _dir; \
|
v0 = _dir; \
|
||||||
break; \
|
break; \
|
||||||
|
@ -1933,10 +1985,13 @@ void psxBios_firstfile() { // 42
|
||||||
|
|
||||||
strcpy(ffile, Ra0);
|
strcpy(ffile, Ra0);
|
||||||
pfile = ffile+5;
|
pfile = ffile+5;
|
||||||
nfile = 1;
|
nfile = 0;
|
||||||
|
|
||||||
if (!strncmp(Ra0, "bu00", 4)) {
|
if (!strncmp(Ra0, "bu00", 4)) {
|
||||||
|
DeliverEvent(0x11, 0x2);
|
||||||
bufile(1);
|
bufile(1);
|
||||||
} else if (!strncmp(Ra0, "bu10", 4)) {
|
} else if (!strncmp(Ra0, "bu10", 4)) {
|
||||||
|
DeliverEvent(0x11, 0x2);
|
||||||
bufile(2);
|
bufile(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2082,21 +2137,21 @@ void psxBios_StopCARD() { // 4c
|
||||||
}
|
}
|
||||||
|
|
||||||
void psxBios__card_write() { // 0x4e
|
void psxBios__card_write() { // 0x4e
|
||||||
int port;
|
int const port = a0 >> 4;
|
||||||
|
u32 const sect = a1 % (MCD_SIZE/8); // roll on range 0...3FFF
|
||||||
|
|
||||||
#ifdef PSXBIOS_LOG
|
#ifdef PSXBIOS_LOG
|
||||||
PSXBIOS_LOG("psxBios_%s: %x,%x,%x\n", biosB0n[0x4e], a0, a1, a2);
|
PSXBIOS_LOG("psxBios_%s, PORT=%i, SECT=%u(%u), DEST=%p\n", biosB0n[0x4e], port, sect, a1, a2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
card_active_chan = a0;
|
card_active_chan = a0;
|
||||||
port = a0 >> 4;
|
|
||||||
|
|
||||||
if (port == 0) {
|
if (port == 0) {
|
||||||
memcpy(Mcd1Data + a1 * 128, Ra2, 128);
|
memcpy(Mcd1Data + (sect * MCD_SECT_SIZE), Ra2, MCD_SECT_SIZE);
|
||||||
SaveMcd(Config.Mcd1, Mcd1Data, a1 * 128, 128);
|
SaveMcd(Config.Mcd1, Mcd1Data, sect * MCD_SECT_SIZE, MCD_SECT_SIZE);
|
||||||
} else {
|
} else {
|
||||||
memcpy(Mcd2Data + a1 * 128, Ra2, 128);
|
memcpy(Mcd2Data + (sect * MCD_SECT_SIZE), Ra2, MCD_SECT_SIZE);
|
||||||
SaveMcd(Config.Mcd2, Mcd2Data, a1 * 128, 128);
|
SaveMcd(Config.Mcd2, Mcd2Data, sect * MCD_SECT_SIZE, MCD_SECT_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004
|
DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004
|
||||||
|
@ -2106,19 +2161,19 @@ void psxBios__card_write() { // 0x4e
|
||||||
}
|
}
|
||||||
|
|
||||||
void psxBios__card_read() { // 0x4f
|
void psxBios__card_read() { // 0x4f
|
||||||
int port;
|
int const port = a0 >> 4;
|
||||||
|
u32 const sect = a1 % (MCD_SIZE/8); // roll on range 0...3FFF
|
||||||
|
|
||||||
#ifdef PSXBIOS_LOG
|
#ifdef PSXBIOS_LOG
|
||||||
PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x4f]);
|
PSXBIOS_LOG("psxBios_%s, PORT=%i, SECT=%u(%u), DEST=%p\n", biosB0n[0x4f], port, sect, a1, a2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
card_active_chan = a0;
|
card_active_chan = a0;
|
||||||
port = a0 >> 4;
|
|
||||||
|
|
||||||
if (port == 0) {
|
if (port == 0) {
|
||||||
memcpy(Ra2, Mcd1Data + a1 * 128, 128);
|
memcpy(Ra2, Mcd1Data + (sect * MCD_SECT_SIZE), MCD_SECT_SIZE);
|
||||||
} else {
|
} else {
|
||||||
memcpy(Ra2, Mcd2Data + a1 * 128, 128);
|
memcpy(Ra2, Mcd2Data + (sect * MCD_SECT_SIZE), MCD_SECT_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004
|
DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004
|
||||||
|
@ -2178,6 +2233,15 @@ void psxBios_Krom2RawAdd() { // 0x51
|
||||||
pc0 = ra;
|
pc0 = ra;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// stub?
|
||||||
|
void psxBios__get_error() { // 55
|
||||||
|
#ifdef PSXBIOS_LOG
|
||||||
|
PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x55]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
v0 = 0; pc0 = ra;
|
||||||
|
}
|
||||||
|
|
||||||
void psxBios_GetC0Table() { // 56
|
void psxBios_GetC0Table() { // 56
|
||||||
#ifdef PSXBIOS_LOG
|
#ifdef PSXBIOS_LOG
|
||||||
PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x56]);
|
PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x56]);
|
||||||
|
@ -2566,7 +2630,7 @@ void psxBiosInit() {
|
||||||
//biosB0[0x52] = psxBios_sys_b0_52;
|
//biosB0[0x52] = psxBios_sys_b0_52;
|
||||||
//biosB0[0x53] = psxBios_sys_b0_53;
|
//biosB0[0x53] = psxBios_sys_b0_53;
|
||||||
//biosB0[0x54] = psxBios__get_errno;
|
//biosB0[0x54] = psxBios__get_errno;
|
||||||
//biosB0[0x55] = psxBios__get_error;
|
biosB0[0x55] = psxBios__get_error;
|
||||||
biosB0[0x56] = psxBios_GetC0Table;
|
biosB0[0x56] = psxBios_GetC0Table;
|
||||||
biosB0[0x57] = psxBios_GetB0Table;
|
biosB0[0x57] = psxBios_GetB0Table;
|
||||||
biosB0[0x58] = psxBios__card_chan;
|
biosB0[0x58] = psxBios__card_chan;
|
||||||
|
|
|
@ -159,6 +159,8 @@ typedef struct {
|
||||||
u8 PsxType; // PSX_TYPE_NTSC or PSX_TYPE_PAL
|
u8 PsxType; // PSX_TYPE_NTSC or PSX_TYPE_PAL
|
||||||
u32 RewindCount;
|
u32 RewindCount;
|
||||||
u32 RewindInterval;
|
u32 RewindInterval;
|
||||||
|
u32 AltSpeed1; // Percent relative to natural speed.
|
||||||
|
u32 AltSpeed2;
|
||||||
u8 HackFix;
|
u8 HackFix;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
char Lang[256];
|
char Lang[256];
|
||||||
|
|
|
@ -59,6 +59,10 @@ void SaveDongle( char *str );
|
||||||
|
|
||||||
static unsigned char buf[ BUFFER_SIZE ];
|
static unsigned char buf[ BUFFER_SIZE ];
|
||||||
|
|
||||||
|
//[0] -> dummy
|
||||||
|
//[1] -> memory card status flag
|
||||||
|
//[2] -> card 1 id, 0x5a->plugged, any other not plugged
|
||||||
|
//[3] -> card 2 id, 0x5d->plugged, any other not plugged
|
||||||
unsigned char cardh[4] = { 0x00, 0x08, 0x5a, 0x5d };
|
unsigned char cardh[4] = { 0x00, 0x08, 0x5a, 0x5d };
|
||||||
|
|
||||||
// Transfer Ready and the Buffer is Empty
|
// Transfer Ready and the Buffer is Empty
|
||||||
|
@ -722,10 +726,12 @@ void sioWrite8(unsigned char value) {
|
||||||
StatReg |= RX_RDY;
|
StatReg |= RX_RDY;
|
||||||
|
|
||||||
// Chronicles of the Sword - no memcard = password options
|
// Chronicles of the Sword - no memcard = password options
|
||||||
if( Config.NoMemcard || ((strlen(Config.Mcd1) <=0) && (strlen(Config.Mcd2) <=0)) ) {
|
if( Config.NoMemcard || (!Config.Mcd1[0] && !Config.Mcd2[0])) {
|
||||||
memset(buf, 0x00, 4);
|
memset(buf, 0x00, 4);
|
||||||
} else {
|
} else {
|
||||||
memcpy(buf, cardh, 4);
|
memcpy(buf, cardh, 4);
|
||||||
|
if (!Config.Mcd1[0]) buf[2]=0; // is card 1 plugged? (Codename Tenka)
|
||||||
|
if (!Config.Mcd2[0]) buf[3]=0; // is card 2 plugged?
|
||||||
}
|
}
|
||||||
|
|
||||||
parp = 0;
|
parp = 0;
|
||||||
|
@ -883,8 +889,8 @@ void LoadMcd(int mcd, char *str) {
|
||||||
if (mcd == 2) data = Mcd2Data;
|
if (mcd == 2) data = Mcd2Data;
|
||||||
|
|
||||||
if (*str == 0) {
|
if (*str == 0) {
|
||||||
sprintf(str, "%s/.pcsxr/memcards/card%d.mcd", getenv("HOME"), mcd); // TODO: maybe just whine and quit..
|
SysPrintf(_("No memory card value was specified - card %i is not plugged.\n"), mcd);
|
||||||
SysPrintf(_("No memory card value was specified - using a default card %s\n"), str);
|
return;
|
||||||
}
|
}
|
||||||
f = fopen(str, "rb");
|
f = fopen(str, "rb");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
|
|
|
@ -31,7 +31,8 @@ extern "C" {
|
||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "psemu_plugin_defs.h"
|
#include "psemu_plugin_defs.h"
|
||||||
|
|
||||||
#define MCD_SIZE (1024 * 8 * 16)
|
#define MCD_SECT_SIZE (8 * 16)
|
||||||
|
#define MCD_SIZE (1024 * MCD_SECT_SIZE)
|
||||||
|
|
||||||
extern char Mcd1Data[MCD_SIZE], Mcd2Data[MCD_SIZE];
|
extern char Mcd1Data[MCD_SIZE], Mcd2Data[MCD_SIZE];
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ static OSStatus GeneratePreviewForMemCard(void *thisInterface, QLPreviewRequestR
|
||||||
NSDictionary *imgProps = @{(NSString *)kQLPreviewPropertyAttachmentDataKey: pngData,
|
NSDictionary *imgProps = @{(NSString *)kQLPreviewPropertyAttachmentDataKey: pngData,
|
||||||
(NSString *)kQLPreviewPropertyMIMETypeKey: @"image/png"};
|
(NSString *)kQLPreviewPropertyMIMETypeKey: @"image/png"};
|
||||||
NSString *imgName = [[@(i++) stringValue] stringByAppendingPathExtension:@"png"];
|
NSString *imgName = [[@(i++) stringValue] stringByAppendingPathExtension:@"png"];
|
||||||
[htmlStr appendFormat:@"\t\t\t<tr><td><img src=\"cid:%@\"></td> <td>%@</td> <td>%i</td></tr>\n", imgName, obj.name, obj.blockSize];
|
[htmlStr appendFormat:@"\t\t\t<tr><td><img src=\"cid:%@\"></td> <td>%@</td> <td>%i</td></tr>\n", imgName, obj.title, obj.blockSize];
|
||||||
htmlDict[imgName] = imgProps;
|
htmlDict[imgName] = imgProps;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ static OSStatus GeneratePreviewForMemCard(void *thisInterface, QLPreviewRequestR
|
||||||
NSDictionary *imgProps = @{(NSString *)kQLPreviewPropertyAttachmentDataKey: gifData,
|
NSDictionary *imgProps = @{(NSString *)kQLPreviewPropertyAttachmentDataKey: gifData,
|
||||||
(NSString *)kQLPreviewPropertyMIMETypeKey: @"image/gif"};
|
(NSString *)kQLPreviewPropertyMIMETypeKey: @"image/gif"};
|
||||||
NSString *imgName = [[@(i++) stringValue] stringByAppendingPathExtension:@"gif"];
|
NSString *imgName = [[@(i++) stringValue] stringByAppendingPathExtension:@"gif"];
|
||||||
[htmlStr appendFormat:@"\t\t\t<tr><td><img src=\"cid:%@\"></td> <td>%@</td> <td>%i</td></tr>\n", imgName, obj.name, obj.blockSize];
|
[htmlStr appendFormat:@"\t\t\t<tr><td><img src=\"cid:%@\"></td> <td>%@</td> <td>%i</td></tr>\n", imgName, obj.title, obj.blockSize];
|
||||||
htmlDict[imgName] = imgProps;
|
htmlDict[imgName] = imgProps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,31 +98,31 @@ static void GetSoloBlockInfo(unsigned char *data, int block, McdBlock *Info)
|
||||||
Info->Flags = *ptr;
|
Info->Flags = *ptr;
|
||||||
|
|
||||||
ptr += 0xa;
|
ptr += 0xa;
|
||||||
strlcpy(Info->ID, ptr, 12);
|
strlcpy(Info->ID, ptr, 13);
|
||||||
ptr += 12;
|
ptr += 12;
|
||||||
strlcpy(Info->Name, ptr, 16);
|
strlcpy(Info->Name, ptr, 17);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline PCSXRMemFlag MemBlockFlag(unsigned char blockFlags)
|
static inline PCSXRMemFlag MemBlockFlag(unsigned char blockFlags)
|
||||||
{
|
{
|
||||||
if ((blockFlags & 0xF0) == 0xA0) {
|
if ((blockFlags & 0xF0) == 0xA0) {
|
||||||
if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3)
|
if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3)
|
||||||
return memFlagDeleted;
|
return PCSXRMemFlagDeleted;
|
||||||
else
|
else
|
||||||
return memFlagFree;
|
return PCSXRMemFlagFree;
|
||||||
} else if ((blockFlags & 0xF0) == 0x50) {
|
} else if ((blockFlags & 0xF0) == 0x50) {
|
||||||
if ((blockFlags & 0xF) == 0x1)
|
if ((blockFlags & 0xF) == 0x1)
|
||||||
return memFlagUsed;
|
return PCSXRMemFlagUsed;
|
||||||
else if ((blockFlags & 0xF) == 0x2)
|
else if ((blockFlags & 0xF) == 0x2)
|
||||||
return memFlagLink;
|
return PCSXRMemFlagLink;
|
||||||
else if ((blockFlags & 0xF) == 0x3)
|
else if ((blockFlags & 0xF) == 0x3)
|
||||||
return memFlagEndLink;
|
return PCSXRMemFlagEndLink;
|
||||||
} else
|
} else
|
||||||
return memFlagFree;
|
return PCSXRMemFlagFree;
|
||||||
|
|
||||||
//Xcode complains unless we do this...
|
//Xcode complains unless we do this...
|
||||||
//NSLog(@"Unknown flag %x", blockFlags);
|
//NSLog(@"Unknown flag %x", blockFlags);
|
||||||
return memFlagFree;
|
return PCSXRMemFlagFree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ NSArray *CreateArrayByEnumeratingMemoryCardAtURL(NSURL *location)
|
||||||
McdBlock memBlock;
|
McdBlock memBlock;
|
||||||
GetSoloBlockInfo((unsigned char *)memPtr, i + 1, &memBlock);
|
GetSoloBlockInfo((unsigned char *)memPtr, i + 1, &memBlock);
|
||||||
|
|
||||||
if (MemBlockFlag(memBlock.Flags) == memFlagFree) {
|
if (MemBlockFlag(memBlock.Flags) == PCSXRMemFlagFree) {
|
||||||
//Free space: ignore
|
//Free space: ignore
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -170,7 +170,7 @@ NSArray *CreateArrayByEnumeratingMemoryCardAtURL(NSURL *location)
|
||||||
};
|
};
|
||||||
PcsxrMemoryObject *obj = [[PcsxrMemoryObject alloc] initWithMcdBlock:&memBlock startingIndex:i size:x];
|
PcsxrMemoryObject *obj = [[PcsxrMemoryObject alloc] initWithMcdBlock:&memBlock startingIndex:i size:x];
|
||||||
i += x;
|
i += x;
|
||||||
if (MemBlockFlag(memBlock.Flags) == memFlagDeleted) {
|
if (MemBlockFlag(memBlock.Flags) == PCSXRMemFlagDeleted) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
[memArray addObject:obj];
|
[memArray addObject:obj];
|
||||||
|
|
|
@ -28,19 +28,19 @@
|
||||||
//
|
//
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
typedef NS_ENUM(NSInteger, PCSXRMemFlags) {
|
typedef NS_ENUM(char, PCSXRMemFlags) {
|
||||||
memFlagDeleted,
|
PCSXRMemFlagDeleted = 0,
|
||||||
memFlagFree,
|
PCSXRMemFlagFree,
|
||||||
memFlagUsed,
|
PCSXRMemFlagUsed,
|
||||||
memFlagLink,
|
PCSXRMemFlagLink,
|
||||||
memFlagEndLink
|
PCSXRMemFlagEndLink
|
||||||
};
|
};
|
||||||
|
|
||||||
static void GetSoloBlockInfo(unsigned char *data, int block, McdBlock *Info)
|
static void GetSoloBlockInfo(unsigned char *data, int block, McdBlock *Info)
|
||||||
{
|
{
|
||||||
unsigned char *ptr = data + block * 8192 + 2;
|
unsigned char *ptr = data + block * 8192 + 2;
|
||||||
unsigned char *str = Info->Title;
|
unsigned char *str = Info->Title;
|
||||||
unsigned char * sstr = Info->sTitle;
|
unsigned char *sstr = Info->sTitle;
|
||||||
unsigned short c;
|
unsigned short c;
|
||||||
int i, x = 0;
|
int i, x = 0;
|
||||||
|
|
||||||
|
@ -103,31 +103,31 @@ static void GetSoloBlockInfo(unsigned char *data, int block, McdBlock *Info)
|
||||||
Info->Flags = *ptr;
|
Info->Flags = *ptr;
|
||||||
|
|
||||||
ptr += 0xa;
|
ptr += 0xa;
|
||||||
strlcpy(Info->ID, ptr, 12);
|
strlcpy(Info->ID, ptr, 13);
|
||||||
ptr += 12;
|
ptr += 12;
|
||||||
strlcpy(Info->Name, ptr, 16);
|
strlcpy(Info->Name, ptr, 17);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline PCSXRMemFlags MemBlockFlag(unsigned char blockFlags)
|
static inline PCSXRMemFlags MemBlockFlag(unsigned char blockFlags)
|
||||||
{
|
{
|
||||||
if ((blockFlags & 0xF0) == 0xA0) {
|
if ((blockFlags & 0xF0) == 0xA0) {
|
||||||
if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3)
|
if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3)
|
||||||
return memFlagDeleted;
|
return PCSXRMemFlagDeleted;
|
||||||
else
|
else
|
||||||
return memFlagFree;
|
return PCSXRMemFlagFree;
|
||||||
} else if ((blockFlags & 0xF0) == 0x50) {
|
} else if ((blockFlags & 0xF0) == 0x50) {
|
||||||
if ((blockFlags & 0xF) == 0x1)
|
if ((blockFlags & 0xF) == 0x1)
|
||||||
return memFlagUsed;
|
return PCSXRMemFlagUsed;
|
||||||
else if ((blockFlags & 0xF) == 0x2)
|
else if ((blockFlags & 0xF) == 0x2)
|
||||||
return memFlagLink;
|
return PCSXRMemFlagLink;
|
||||||
else if ((blockFlags & 0xF) == 0x3)
|
else if ((blockFlags & 0xF) == 0x3)
|
||||||
return memFlagEndLink;
|
return PCSXRMemFlagEndLink;
|
||||||
} else
|
} else
|
||||||
return memFlagFree;
|
return PCSXRMemFlagFree;
|
||||||
|
|
||||||
//Xcode complains unless we do this...
|
//Xcode complains unless we do this...
|
||||||
//NSLog(@"Unknown flag %x", blockFlags);
|
//NSLog(@"Unknown flag %x", blockFlags);
|
||||||
return memFlagFree;
|
return PCSXRMemFlagFree;
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean GetMetadataForFile(void *thisInterface, CFMutableDictionaryRef attributes, CFStringRef contentTypeUTI, CFStringRef pathToFile)
|
Boolean GetMetadataForFile(void *thisInterface, CFMutableDictionaryRef attributes, CFStringRef contentTypeUTI, CFStringRef pathToFile)
|
||||||
|
@ -167,7 +167,7 @@ Boolean GetMetadataForFile(void *thisInterface, CFMutableDictionaryRef attribute
|
||||||
|
|
||||||
GetSoloBlockInfo((unsigned char *)fileCData, i + 1, &memBlock);
|
GetSoloBlockInfo((unsigned char *)fileCData, i + 1, &memBlock);
|
||||||
|
|
||||||
if (MemBlockFlag(memBlock.Flags) == memFlagFree) {
|
if (MemBlockFlag(memBlock.Flags) == PCSXRMemFlagFree) {
|
||||||
//Free space: ignore
|
//Free space: ignore
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -184,9 +184,9 @@ Boolean GetMetadataForFile(void *thisInterface, CFMutableDictionaryRef attribute
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Ignore deleted blocks
|
|
||||||
i += x;
|
i += x;
|
||||||
if (MemBlockFlag(memBlock.Flags) == memFlagDeleted) {
|
// Ignore deleted blocks
|
||||||
|
if (MemBlockFlag(memBlock.Flags) == PCSXRMemFlagDeleted) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
memCount++;
|
memCount++;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7702"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="CheatController">
|
<customObject id="-2" userLabel="File's Owner" customClass="CheatController">
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
</button>
|
</button>
|
||||||
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="23">
|
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="23">
|
||||||
<rect key="frame" x="20" y="61" width="658" height="276"/>
|
<rect key="frame" x="20" y="61" width="658" height="276"/>
|
||||||
<clipView key="contentView" misplaced="YES" id="6pF-og-es3">
|
<clipView key="contentView" id="6pF-og-es3">
|
||||||
<rect key="frame" x="1" y="17" width="656" height="258"/>
|
<rect key="frame" x="1" y="17" width="656" height="258"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
<rect key="frame" x="0.0" y="0.0" width="656" height="19"/>
|
<rect key="frame" x="0.0" y="0.0" width="656" height="19"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<size key="intercellSpacing" width="3" height="2"/>
|
<size key="intercellSpacing" width="3" height="2"/>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||||
<tableColumns>
|
<tableColumns>
|
||||||
<tableColumn identifier="Enabled" width="48.40234375" minWidth="40" maxWidth="1000" id="29">
|
<tableColumn identifier="Enabled" width="48.40234375" minWidth="40" maxWidth="1000" id="29">
|
||||||
|
@ -184,6 +184,7 @@
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="removeCheats:" target="-2" id="are-w2-Cx9"/>
|
<action selector="removeCheats:" target="-2" id="are-w2-Cx9"/>
|
||||||
|
<binding destination="237" name="enabled" keyPath="canRemove" id="3pC-QD-cnV"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
|
@ -223,7 +224,7 @@
|
||||||
<subviews>
|
<subviews>
|
||||||
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="136">
|
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="136">
|
||||||
<rect key="frame" x="20" y="53" width="302" height="192"/>
|
<rect key="frame" x="20" y="53" width="302" height="192"/>
|
||||||
<clipView key="contentView" misplaced="YES" id="COc-Cf-C5K">
|
<clipView key="contentView" id="COc-Cf-C5K">
|
||||||
<rect key="frame" x="1" y="17" width="300" height="174"/>
|
<rect key="frame" x="1" y="17" width="300" height="174"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
|
@ -231,7 +232,7 @@
|
||||||
<rect key="frame" x="0.0" y="0.0" width="300" height="19"/>
|
<rect key="frame" x="0.0" y="0.0" width="300" height="19"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<size key="intercellSpacing" width="3" height="2"/>
|
<size key="intercellSpacing" width="3" height="2"/>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||||
<tableColumns>
|
<tableColumns>
|
||||||
<tableColumn identifier="Address" width="150" minWidth="40" maxWidth="1000" id="141">
|
<tableColumn identifier="Address" width="150" minWidth="40" maxWidth="1000" id="141">
|
||||||
|
@ -352,6 +353,7 @@ Gw
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="removeCheatValue:" target="-2" id="215"/>
|
<action selector="removeCheatValue:" target="-2" id="215"/>
|
||||||
|
<binding destination="219" name="enabled" keyPath="canRemove" id="0Ve-Bf-kaw"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
|
|
|
@ -192,7 +192,7 @@
|
||||||
|
|
||||||
- (IBAction)closeCheatEdit:(id)sender
|
- (IBAction)closeCheatEdit:(id)sender
|
||||||
{
|
{
|
||||||
[NSApp endSheet:editCheatWindow returnCode:[sender tag] == 1 ? NSCancelButton : NSOKButton];
|
[[self window] endSheet:editCheatWindow returnCode:[sender tag] == 1 ? NSCancelButton : NSOKButton];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)changeCheat:(id)sender
|
- (IBAction)changeCheat:(id)sender
|
||||||
|
|
|
@ -103,7 +103,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
|
||||||
McdBlock memBlock;
|
McdBlock memBlock;
|
||||||
GetMcdBlockInfo(carNum, i + 1, &memBlock);
|
GetMcdBlockInfo(carNum, i + 1, &memBlock);
|
||||||
|
|
||||||
if ([PcsxrMemoryObject memFlagsFromBlockFlags:memBlock.Flags] == memFlagFree) {
|
if ([PcsxrMemoryObject memFlagsFromBlockFlags:memBlock.Flags] == PCSXRMemFlagFree) {
|
||||||
//Free space: ignore
|
//Free space: ignore
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -220,7 +220,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
|
||||||
{
|
{
|
||||||
int memSize = MAX_MEMCARD_BLOCKS;
|
int memSize = MAX_MEMCARD_BLOCKS;
|
||||||
for (PcsxrMemoryObject *memObj in rawArray) {
|
for (PcsxrMemoryObject *memObj in rawArray) {
|
||||||
if (memObj.flag != memFlagDeleted) {
|
if (memObj.flag != PCSXRMemFlagDeleted) {
|
||||||
memSize -= memObj.blockSize;
|
memSize -= memObj.blockSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,9 +272,9 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
|
||||||
GetMcdBlockInfo(cardNumber, i+1, &baseBlock);
|
GetMcdBlockInfo(cardNumber, i+1, &baseBlock);
|
||||||
PCSXRMemFlag theFlags = [PcsxrMemoryObject memFlagsFromBlockFlags:baseBlock.Flags];
|
PCSXRMemFlag theFlags = [PcsxrMemoryObject memFlagsFromBlockFlags:baseBlock.Flags];
|
||||||
|
|
||||||
if (theFlags == memFlagDeleted || theFlags == memFlagFree) {
|
if (theFlags == PCSXRMemFlagDeleted || theFlags == PCSXRMemFlagFree) {
|
||||||
PCSXRMemFlag up1Flags = theFlags;
|
PCSXRMemFlag up1Flags = theFlags;
|
||||||
while ((up1Flags == memFlagDeleted || up1Flags == memFlagFree) && x < MAX_MEMCARD_BLOCKS) {
|
while ((up1Flags == PCSXRMemFlagDeleted || up1Flags == PCSXRMemFlagFree) && x < MAX_MEMCARD_BLOCKS) {
|
||||||
x++;
|
x++;
|
||||||
McdBlock up1Block;
|
McdBlock up1Block;
|
||||||
GetMcdBlockInfo(cardNumber, x+1, &up1Block);
|
GetMcdBlockInfo(cardNumber, x+1, &up1Block);
|
||||||
|
@ -300,7 +300,6 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
|
||||||
|
|
||||||
- (void)deleteMemoryBlocksAtIndex:(int)slotnum
|
- (void)deleteMemoryBlocksAtIndex:(int)slotnum
|
||||||
{
|
{
|
||||||
int xor = 0, i, j;
|
|
||||||
char *data, *ptr, *filename;
|
char *data, *ptr, *filename;
|
||||||
if (cardNumber == 1) {
|
if (cardNumber == 1) {
|
||||||
filename = Config.Mcd1;
|
filename = Config.Mcd1;
|
||||||
|
@ -321,8 +320,9 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
|
||||||
|
|
||||||
McdBlock flagBlock;
|
McdBlock flagBlock;
|
||||||
|
|
||||||
for(i = theObj.startingIndex + 1; i < (theObj.startingIndex + theObj.blockSize + 1); i++)
|
for(int i = theObj.startingIndex + 1; i < (theObj.startingIndex + theObj.blockSize + 1); i++)
|
||||||
{
|
{
|
||||||
|
char xor = 0;
|
||||||
GetMcdBlockInfo(cardNumber, i, &flagBlock);
|
GetMcdBlockInfo(cardNumber, i, &flagBlock);
|
||||||
ptr = data + i * 128;
|
ptr = data + i * 128;
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str)
|
||||||
*ptr = 0xA0 | (flagBlock.Flags & 0xF);
|
*ptr = 0xA0 | (flagBlock.Flags & 0xF);
|
||||||
} else { continue; }
|
} else { continue; }
|
||||||
|
|
||||||
for (j = 0; j < 127; j++) xor ^= *ptr++;
|
for (unsigned char j = 0; j < 127; j++) xor ^= *ptr++;
|
||||||
*ptr = xor;
|
*ptr = xor;
|
||||||
|
|
||||||
SaveMcd(filename, data, i * 128, 128);
|
SaveMcd(filename, data, i * 128, 128);
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
|
|
||||||
int cardSize, freeConsBlocks, availBlocks;
|
int cardSize, freeConsBlocks, availBlocks;
|
||||||
|
|
||||||
if ([[fromCard memoryArray][selectedIndex] flag] == memFlagFree) {
|
if ([[fromCard memoryArray][selectedIndex] flag] == PCSXRMemFlagFree) {
|
||||||
NSBeep();
|
NSBeep();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@
|
||||||
|
|
||||||
PcsxrMemoryObject *tmpObj = [curCard memoryArray][selectedIndex];
|
PcsxrMemoryObject *tmpObj = [curCard memoryArray][selectedIndex];
|
||||||
|
|
||||||
if (tmpObj.flag == memFlagFree) {
|
if (tmpObj.flag == PCSXRMemFlagFree) {
|
||||||
NSBeep();
|
NSBeep();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,11 @@
|
||||||
#include "sio.h"
|
#include "sio.h"
|
||||||
|
|
||||||
typedef NS_ENUM(char, PCSXRMemFlag) {
|
typedef NS_ENUM(char, PCSXRMemFlag) {
|
||||||
memFlagDeleted,
|
PCSXRMemFlagDeleted,
|
||||||
memFlagFree,
|
PCSXRMemFlagFree,
|
||||||
memFlagUsed,
|
PCSXRMemFlagUsed,
|
||||||
memFlagLink,
|
PCSXRMemFlagLink,
|
||||||
memFlagEndLink
|
PCSXRMemFlagEndLink
|
||||||
};
|
};
|
||||||
|
|
||||||
@interface PcsxrMemoryObject : NSObject
|
@interface PcsxrMemoryObject : NSObject
|
||||||
|
|
|
@ -22,32 +22,37 @@
|
||||||
@property (readwrite) BOOL hasImages;
|
@property (readwrite) BOOL hasImages;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
#pragma pack(push,2)
|
||||||
|
struct PSXRGBColor {
|
||||||
|
UInt8 r;
|
||||||
|
UInt8 g;
|
||||||
|
UInt8 b;
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
@implementation PcsxrMemoryObject
|
@implementation PcsxrMemoryObject
|
||||||
|
|
||||||
+ (NSArray *)imagesFromMcd:(McdBlock *)block
|
+ (NSArray *)imagesFromMcd:(McdBlock *)block
|
||||||
{
|
{
|
||||||
NSMutableArray *imagesArray = [[NSMutableArray alloc] initWithCapacity:block->IconCount];
|
NSMutableArray *imagesArray = [[NSMutableArray alloc] initWithCapacity:block->IconCount];
|
||||||
for (int i = 0; i < block->IconCount; i++) {
|
for (int i = 0; i < block->IconCount; i++) {
|
||||||
NSImage *memImage;
|
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:16 pixelsHigh:16 bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bytesPerRow:16*3 bitsPerPixel:24];
|
||||||
@autoreleasepool {
|
struct PSXRGBColor *cocoaImageData = (struct PSXRGBColor *)imageRep.bitmapData;
|
||||||
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:16 pixelsHigh:16 bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bytesPerRow:0 bitsPerPixel:0];
|
short *icon = block->Icon;
|
||||||
|
|
||||||
short *icon = block->Icon;
|
for (int v = 0; v < 256; v++) {
|
||||||
|
int c = icon[(i * 256) + v];
|
||||||
int x, y, c, v, r, g, b;
|
int r = (c & 0x001f) << 3;
|
||||||
for (v = 0; v < 256; v++) {
|
int g = ((c & 0x03e0) >> 5) << 3;
|
||||||
x = (v % 16);
|
int b = ((c & 0x7c00) >> 10) << 3;
|
||||||
y = (v / 16);
|
struct PSXRGBColor *colorItem = &cocoaImageData[v];
|
||||||
c = icon[(i * 256) + v];
|
colorItem->r = r;
|
||||||
r = (c & 0x001f) << 3;
|
colorItem->g = g;
|
||||||
g = ((c & 0x03e0) >> 5) << 3;
|
colorItem->b = b;
|
||||||
b = ((c & 0x7c00) >> 10) << 3;
|
|
||||||
[imageRep setColor:[NSColor colorWithCalibratedRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0] atX:x y:y];
|
|
||||||
}
|
|
||||||
memImage = [[NSImage alloc] init];
|
|
||||||
[memImage addRepresentation:imageRep];
|
|
||||||
[memImage setSize:NSMakeSize(32, 32)];
|
|
||||||
}
|
}
|
||||||
|
NSImage *memImage = [[NSImage alloc] init];
|
||||||
|
[memImage addRepresentation:imageRep];
|
||||||
|
[memImage setSize:NSMakeSize(32, 32)];
|
||||||
[imagesArray addObject:memImage];
|
[imagesArray addObject:memImage];
|
||||||
}
|
}
|
||||||
return [NSArray arrayWithArray:imagesArray];
|
return [NSArray arrayWithArray:imagesArray];
|
||||||
|
@ -86,23 +91,23 @@ static NSString *MemLabelMultiSave;
|
||||||
{
|
{
|
||||||
switch (flagNameIndex) {
|
switch (flagNameIndex) {
|
||||||
default:
|
default:
|
||||||
case memFlagFree:
|
case PCSXRMemFlagFree:
|
||||||
return MemLabelFree;
|
return MemLabelFree;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case memFlagEndLink:
|
case PCSXRMemFlagEndLink:
|
||||||
return MemLabelEndLink;
|
return MemLabelEndLink;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case memFlagLink:
|
case PCSXRMemFlagLink:
|
||||||
return MemLabelLink;
|
return MemLabelLink;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case memFlagUsed:
|
case PCSXRMemFlagUsed:
|
||||||
return MemLabelUsed;
|
return MemLabelUsed;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case memFlagDeleted:
|
case PCSXRMemFlagDeleted:
|
||||||
return MemLabelDeleted;
|
return MemLabelDeleted;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -126,22 +131,22 @@ static NSString *MemLabelMultiSave;
|
||||||
{
|
{
|
||||||
if ((blockFlags & 0xF0) == 0xA0) {
|
if ((blockFlags & 0xF0) == 0xA0) {
|
||||||
if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3)
|
if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3)
|
||||||
return memFlagDeleted;
|
return PCSXRMemFlagDeleted;
|
||||||
else
|
else
|
||||||
return memFlagFree;
|
return PCSXRMemFlagFree;
|
||||||
} else if ((blockFlags & 0xF0) == 0x50) {
|
} else if ((blockFlags & 0xF0) == 0x50) {
|
||||||
if ((blockFlags & 0xF) == 0x1)
|
if ((blockFlags & 0xF) == 0x1)
|
||||||
return memFlagUsed;
|
return PCSXRMemFlagUsed;
|
||||||
else if ((blockFlags & 0xF) == 0x2)
|
else if ((blockFlags & 0xF) == 0x2)
|
||||||
return memFlagLink;
|
return PCSXRMemFlagLink;
|
||||||
else if ((blockFlags & 0xF) == 0x3)
|
else if ((blockFlags & 0xF) == 0x3)
|
||||||
return memFlagEndLink;
|
return PCSXRMemFlagEndLink;
|
||||||
} else
|
} else
|
||||||
return memFlagFree;
|
return PCSXRMemFlagFree;
|
||||||
|
|
||||||
//Xcode complains unless we do this...
|
//Xcode complains unless we do this...
|
||||||
NSLog(@"Unknown flag %x", blockFlags);
|
NSLog(@"Unknown flag %x", blockFlags);
|
||||||
return memFlagFree;
|
return PCSXRMemFlagFree;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithMcdBlock:(McdBlock *)infoBlock startingIndex:(uint8_t)startIdx size:(uint8_t)memSize
|
- (instancetype)initWithMcdBlock:(McdBlock *)infoBlock startingIndex:(uint8_t)startIdx size:(uint8_t)memSize
|
||||||
|
@ -150,7 +155,7 @@ static NSString *MemLabelMultiSave;
|
||||||
self.startingIndex = startIdx;
|
self.startingIndex = startIdx;
|
||||||
self.blockSize = memSize;
|
self.blockSize = memSize;
|
||||||
self.flag = [PcsxrMemoryObject memFlagsFromBlockFlags:infoBlock->Flags];
|
self.flag = [PcsxrMemoryObject memFlagsFromBlockFlags:infoBlock->Flags];
|
||||||
if (self.flag == memFlagFree) {
|
if (self.flag == PCSXRMemFlagFree) {
|
||||||
self.imageArray = @[];
|
self.imageArray = @[];
|
||||||
self.hasImages = NO;
|
self.hasImages = NO;
|
||||||
self.title = @"Free block";
|
self.title = @"Free block";
|
||||||
|
@ -279,23 +284,23 @@ static inline void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtc
|
||||||
|
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
default:
|
default:
|
||||||
case memFlagFree:
|
case PCSXRMemFlagFree:
|
||||||
return attribMemLabelFree;
|
return attribMemLabelFree;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case memFlagEndLink:
|
case PCSXRMemFlagEndLink:
|
||||||
return attribMemLabelEndLink;
|
return attribMemLabelEndLink;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case memFlagLink:
|
case PCSXRMemFlagLink:
|
||||||
return attribMemLabelLink;
|
return attribMemLabelLink;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case memFlagUsed:
|
case PCSXRMemFlagUsed:
|
||||||
return attribMemLabelUsed;
|
return attribMemLabelUsed;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case memFlagDeleted:
|
case PCSXRMemFlagDeleted:
|
||||||
return attribMemLabelDeleted;
|
return attribMemLabelDeleted;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -303,7 +308,7 @@ static inline void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtc
|
||||||
|
|
||||||
- (BOOL)showCount
|
- (BOOL)showCount
|
||||||
{
|
{
|
||||||
if (flag == memFlagFree) {
|
if (flag == PCSXRMemFlagFree) {
|
||||||
//Always show the size of the free blocks
|
//Always show the size of the free blocks
|
||||||
return YES;
|
return YES;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -242,20 +242,15 @@
|
||||||
#define PluginSymbolNameConfigure(type) PluginSymbolName(type, @"configure")
|
#define PluginSymbolNameConfigure(type) PluginSymbolName(type, @"configure")
|
||||||
#define PluginSymbolNameAbout(type) PluginSymbolName(type, @"about")
|
#define PluginSymbolNameAbout(type) PluginSymbolName(type, @"about")
|
||||||
|
|
||||||
- (void)runCommand:(id)arg
|
- (void)runCommandNamed:(NSString*)arg
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
long (*func)(void);
|
||||||
NSString *funcName = arg[0];
|
|
||||||
long (*func)(void);
|
func = SysLoadSym(pluginRef, [arg cStringUsingEncoding:NSASCIIStringEncoding]);
|
||||||
|
if (SysLibError() == NULL) {
|
||||||
func = SysLoadSym(pluginRef, [funcName cStringUsingEncoding:NSASCIIStringEncoding]);
|
func();
|
||||||
if (SysLibError() == NULL) {
|
} else {
|
||||||
func();
|
NSBeep();
|
||||||
} else {
|
|
||||||
NSBeep();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,26 +331,24 @@
|
||||||
|
|
||||||
- (void)aboutAs:(int)aType
|
- (void)aboutAs:(int)aType
|
||||||
{
|
{
|
||||||
NSArray *arg;
|
|
||||||
|
|
||||||
NSString *aboutSym = PluginSymbolNameAbout(aType);
|
NSString *aboutSym = PluginSymbolNameAbout(aType);
|
||||||
arg = @[aboutSym, @0];
|
//NSArray *arg = @[aboutSym, @0];
|
||||||
|
|
||||||
// detach a new thread
|
// detach a new thread
|
||||||
[NSThread detachNewThreadSelector:@selector(runCommand:) toTarget:self
|
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||||
withObject:arg];
|
[self runCommandNamed:aboutSym];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)configureAs:(int)aType
|
- (void)configureAs:(int)aType
|
||||||
{
|
{
|
||||||
NSArray *arg;
|
|
||||||
|
|
||||||
NSString *configSym = PluginSymbolNameConfigure(aType);
|
NSString *configSym = PluginSymbolNameConfigure(aType);
|
||||||
arg = @[configSym, @1];
|
//NSArray *arg = @[configSym, @1];
|
||||||
|
|
||||||
// detach a new thread
|
// detach a new thread
|
||||||
[NSThread detachNewThreadSelector:@selector(runCommand:) toTarget:self
|
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||||
withObject:arg];
|
[self runCommandNamed:configSym];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)displayVersion
|
- (NSString *)displayVersion
|
||||||
|
@ -376,7 +369,7 @@
|
||||||
if (_name == nil)
|
if (_name == nil)
|
||||||
return [path lastPathComponent];
|
return [path lastPathComponent];
|
||||||
|
|
||||||
return [NSString stringWithFormat:@"%@ %@ [%@]", self.name, [self displayVersion], [path lastPathComponent]];
|
return [NSString stringWithFormat:@"%@ %@ [%@]", self.name, self.displayVersion, path.lastPathComponent];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*)debugDescription
|
- (NSString*)debugDescription
|
||||||
|
@ -384,7 +377,7 @@
|
||||||
if (_name == nil) {
|
if (_name == nil) {
|
||||||
return fullPlugPath;
|
return fullPlugPath;
|
||||||
}
|
}
|
||||||
return [NSString stringWithFormat:@"%@, %@ [%@]", self.name, [self displayVersion], fullPlugPath];
|
return [NSString stringWithFormat:@"%@, %@ [%@]", self.name, self.displayVersion, fullPlugPath];
|
||||||
}
|
}
|
||||||
|
|
||||||
// the plugin will check if it's still valid and return the status
|
// the plugin will check if it's still valid and return the status
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
|
|
||||||
// Apple deprecated __private_extern__ in Xcode 4.6.
|
// Apple deprecated __private_extern__ in Xcode 4.6.
|
||||||
// This is a convenience declaration to retain the old behavior.
|
// This is a convenience declaration to retain the old behavior.
|
||||||
|
#ifndef __private_extern
|
||||||
#define __private_extern __attribute__((visibility("hidden")))
|
#define __private_extern __attribute__((visibility("hidden")))
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
@ -61,7 +61,9 @@ const char *EmuKeyText[EMU_TOTAL] = {
|
||||||
N_("Save state"),
|
N_("Save state"),
|
||||||
N_("Screenshot"),
|
N_("Screenshot"),
|
||||||
N_("Escape"),
|
N_("Escape"),
|
||||||
N_("Rewind")
|
N_("Rewind"),
|
||||||
|
N_("Alt Speed 1"),
|
||||||
|
N_("Alt Speed 2")
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *DPadText[DKEY_TOTAL] = {
|
const char *DPadText[DKEY_TOTAL] = {
|
||||||
|
|
|
@ -126,6 +126,8 @@ static void SetDefaultConfig() {
|
||||||
g.cfg.E.EmuDef[EMU_SCREENSHOT].EmuKeyEvent = XK_F8;
|
g.cfg.E.EmuDef[EMU_SCREENSHOT].EmuKeyEvent = XK_F8;
|
||||||
g.cfg.E.EmuDef[EMU_ESCAPE].EmuKeyEvent = XK_Escape;
|
g.cfg.E.EmuDef[EMU_ESCAPE].EmuKeyEvent = XK_Escape;
|
||||||
g.cfg.E.EmuDef[EMU_REWIND].EmuKeyEvent = XK_BackSpace;
|
g.cfg.E.EmuDef[EMU_REWIND].EmuKeyEvent = XK_BackSpace;
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED1].EmuKeyEvent = XK_bracketleft;
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED2].EmuKeyEvent = XK_bracketright;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadPADConfig() {
|
void LoadPADConfig() {
|
||||||
|
@ -199,6 +201,16 @@ void LoadPADConfig() {
|
||||||
g.cfg.E.EmuDef[EMU_REWIND].Mapping.Key = a;
|
g.cfg.E.EmuDef[EMU_REWIND].Mapping.Key = a;
|
||||||
g.cfg.E.EmuDef[EMU_REWIND].Mapping.JoyEvType = b;
|
g.cfg.E.EmuDef[EMU_REWIND].Mapping.JoyEvType = b;
|
||||||
g.cfg.E.EmuDef[EMU_REWIND].Mapping.J.d = c;
|
g.cfg.E.EmuDef[EMU_REWIND].Mapping.J.d = c;
|
||||||
|
} else if (strncmp(buf, "EMU_ALTSPEED1=", 14) == 0) {
|
||||||
|
sscanf(buf, "EMU_ALTSPEED1=%d,%d,%d", &a, &b, &c);
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED1].Mapping.Key = a;
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED1].Mapping.JoyEvType = b;
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED1].Mapping.J.d = c;
|
||||||
|
} else if (strncmp(buf, "EMU_ALTSPEED2=", 14) == 0) {
|
||||||
|
sscanf(buf, "EMU_ALTSPEED2=%d,%d,%d", &a, &b, &c);
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED2].Mapping.Key = a;
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED2].Mapping.JoyEvType = b;
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED2].Mapping.J.d = c;
|
||||||
} else if (strncmp(buf, "Select=", 7) == 0) {
|
} else if (strncmp(buf, "Select=", 7) == 0) {
|
||||||
sscanf(buf, "Select=%d,%d,%d", &a, &b, &c);
|
sscanf(buf, "Select=%d,%d,%d", &a, &b, &c);
|
||||||
g.cfg.PadDef[current].KeyDef[DKEY_SELECT].Key = a;
|
g.cfg.PadDef[current].KeyDef[DKEY_SELECT].Key = a;
|
||||||
|
@ -437,5 +449,13 @@ void SavePADConfig() {
|
||||||
fprintf(fp, "EMU_REWIND=%d,%d,%d\n", g.cfg.E.EmuDef[EMU_REWIND].Mapping.Key,
|
fprintf(fp, "EMU_REWIND=%d,%d,%d\n", g.cfg.E.EmuDef[EMU_REWIND].Mapping.Key,
|
||||||
g.cfg.E.EmuDef[EMU_REWIND].Mapping.JoyEvType,
|
g.cfg.E.EmuDef[EMU_REWIND].Mapping.JoyEvType,
|
||||||
g.cfg.E.EmuDef[EMU_REWIND].Mapping.J.d);
|
g.cfg.E.EmuDef[EMU_REWIND].Mapping.J.d);
|
||||||
|
fprintf(fp, "EMU_ALTSPEED1=%d,%d,%d\n",
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED1].Mapping.Key,
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED1].Mapping.JoyEvType,
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED1].Mapping.J.d);
|
||||||
|
fprintf(fp, "EMU_ALTSPEED2=%d,%d,%d\n",
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED2].Mapping.Key,
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED2].Mapping.JoyEvType,
|
||||||
|
g.cfg.E.EmuDef[EMU_ALTSPEED2].Mapping.J.d);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,8 @@ enum {
|
||||||
EMU_SCREENSHOT,
|
EMU_SCREENSHOT,
|
||||||
EMU_ESCAPE,
|
EMU_ESCAPE,
|
||||||
EMU_REWIND,
|
EMU_REWIND,
|
||||||
|
EMU_ALTSPEED1,
|
||||||
|
EMU_ALTSPEED2,
|
||||||
|
|
||||||
EMU_TOTAL
|
EMU_TOTAL
|
||||||
};
|
};
|
||||||
|
|
|
@ -902,11 +902,10 @@ static XVisualInfo *myvisual;
|
||||||
Display *display;
|
Display *display;
|
||||||
static Colormap colormap;
|
static Colormap colormap;
|
||||||
Window window;
|
Window window;
|
||||||
|
Window overlay;
|
||||||
static GC hGC;
|
static GC hGC;
|
||||||
static XImage * Ximage;
|
static XImage * Ximage;
|
||||||
static XvImage * XCimage;
|
|
||||||
static XImage * XPimage=0;
|
static XImage * XPimage=0;
|
||||||
char * Xpixels;
|
|
||||||
char * pCaptionText;
|
char * pCaptionText;
|
||||||
|
|
||||||
static int fx=0;
|
static int fx=0;
|
||||||
|
@ -949,15 +948,15 @@ void DestroyDisplay(void)
|
||||||
XFreeGC(display,hGC);
|
XFreeGC(display,hGC);
|
||||||
hGC = 0;
|
hGC = 0;
|
||||||
}
|
}
|
||||||
|
if (overlay)
|
||||||
|
{
|
||||||
|
XDestroyWindow(display, overlay);
|
||||||
|
overlay = 0;
|
||||||
|
}
|
||||||
if(Ximage)
|
if(Ximage)
|
||||||
{
|
{
|
||||||
XDestroyImage(Ximage);
|
XDestroyImage(Ximage);
|
||||||
Ximage=0;
|
Ximage=0;
|
||||||
}
|
|
||||||
if(XCimage)
|
|
||||||
{
|
|
||||||
XFree(XCimage);
|
|
||||||
XCimage=0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XShmDetach(display,&shminfo);
|
XShmDetach(display,&shminfo);
|
||||||
|
@ -1254,6 +1253,22 @@ void CreateDisplay(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
overlay=XCreateWindow(display,window,
|
||||||
|
iResX - 128,0,128,96,
|
||||||
|
0,myvisual->depth,
|
||||||
|
InputOutput,myvisual->visual,
|
||||||
|
CWBorderPixel | CWBackPixel |
|
||||||
|
CWEventMask | CWDontPropagate |
|
||||||
|
CWColormap | CWCursor | CWEventMask,
|
||||||
|
&winattr);
|
||||||
|
|
||||||
|
if(!overlay)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"Failed in XCreateWindow()!!!\n");
|
||||||
|
DestroyDisplay();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
delwindow = XInternAtom(display,"WM_DELETE_WINDOW",0);
|
delwindow = XInternAtom(display,"WM_DELETE_WINDOW",0);
|
||||||
XSetWMProtocols(display, window, &delwindow, 1);
|
XSetWMProtocols(display, window, &delwindow, 1);
|
||||||
|
|
||||||
|
@ -1352,14 +1367,6 @@ void CreateDisplay(void)
|
||||||
else
|
else
|
||||||
color = 0;
|
color = 0;
|
||||||
|
|
||||||
Xpixels = (char *)malloc(8*8*4);
|
|
||||||
for(i = 0; i < 8*8; ++i)
|
|
||||||
((uint32_t *)Xpixels)[i] = color;
|
|
||||||
|
|
||||||
XCimage = XvCreateImage(display,xv_port,xv_id,
|
|
||||||
(char *)Xpixels, 8, 8);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Allocate max that could be needed:
|
Allocate max that could be needed:
|
||||||
Big(est?) PSX res: 640x512
|
Big(est?) PSX res: 640x512
|
||||||
|
@ -1676,6 +1683,7 @@ void DoBufferSwap(void)
|
||||||
_w, _h, //dst w,h
|
_w, _h, //dst w,h
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
DisplayPic();
|
||||||
|
|
||||||
if(ulKeybits&KEY_SHOWFPS) //DisplayText(); c // paint menu text
|
if(ulKeybits&KEY_SHOWFPS) //DisplayText(); c // paint menu text
|
||||||
{
|
{
|
||||||
|
@ -1695,7 +1703,6 @@ void DoBufferSwap(void)
|
||||||
XDrawImageString(display,window,hGC,2,13,szDispBuf,strlen(szDispBuf));
|
XDrawImageString(display,window,hGC,2,13,szDispBuf,strlen(szDispBuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(XPimage) DisplayPic();
|
|
||||||
|
|
||||||
XFree(xvi);
|
XFree(xvi);
|
||||||
}
|
}
|
||||||
|
@ -1707,15 +1714,11 @@ void DoClearScreenBuffer(void) // CLEAR DX BUFFER
|
||||||
|
|
||||||
XGetGeometry(display, window, &_dw, (int *)&_d, (int *)&_d, &_w, &_h, &_d, &_d);
|
XGetGeometry(display, window, &_dw, (int *)&_d, (int *)&_d, &_w, &_h, &_d, &_d);
|
||||||
|
|
||||||
XvPutImage(display, xv_port, window, hGC, XCimage,
|
|
||||||
0, 0, 8, 8, 0, 0, _w, _h);
|
|
||||||
//XSync(display,False);
|
//XSync(display,False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoClearFrontBuffer(void) // CLEAR DX BUFFER
|
void DoClearFrontBuffer(void) // CLEAR DX BUFFER
|
||||||
{/*
|
{/*
|
||||||
XPutImage(display,window,hGC, XCimage,
|
|
||||||
0, 0, 0, 0, iResX, iResY);
|
|
||||||
XSync(display,False);*/
|
XSync(display,False);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1877,9 +1880,7 @@ void CreatePic(unsigned char * pMem)
|
||||||
void DestroyPic(void)
|
void DestroyPic(void)
|
||||||
{
|
{
|
||||||
if(XPimage)
|
if(XPimage)
|
||||||
{ /*
|
{
|
||||||
XPutImage(display,window,hGC, XCimage,
|
|
||||||
0, 0, 0, 0, iResX, iResY);*/
|
|
||||||
XDestroyImage(XPimage);
|
XDestroyImage(XPimage);
|
||||||
XPimage=0;
|
XPimage=0;
|
||||||
}
|
}
|
||||||
|
@ -1887,8 +1888,20 @@ void DestroyPic(void)
|
||||||
|
|
||||||
void DisplayPic(void)
|
void DisplayPic(void)
|
||||||
{
|
{
|
||||||
XPutImage(display,window,hGC, XPimage,
|
static int mapped = 0;
|
||||||
0, 0, iResX-128, 0,128,96);
|
if (XPimage) {
|
||||||
|
if (!mapped) {
|
||||||
|
XMapWindow(display, overlay);
|
||||||
|
mapped = 1;
|
||||||
|
}
|
||||||
|
XPutImage(display,overlay,hGC, XPimage,
|
||||||
|
0,0, 0,0, 128,96);
|
||||||
|
} else {
|
||||||
|
if (mapped) {
|
||||||
|
XUnmapWindow(display, overlay);
|
||||||
|
mapped = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowGpuPic(void)
|
void ShowGpuPic(void)
|
||||||
|
|
|
@ -36,8 +36,16 @@ BOOL bInitCap = TRUE;
|
||||||
float fps_skip = 0;
|
float fps_skip = 0;
|
||||||
float fps_cur = 0;
|
float fps_cur = 0;
|
||||||
|
|
||||||
|
float speed = 1;
|
||||||
|
|
||||||
#define MAXLACE 16
|
#define MAXLACE 16
|
||||||
|
|
||||||
|
void CALLBACK GPUsetSpeed(float newSpeed) {
|
||||||
|
if (newSpeed > 0 && newSpeed <= 1000) {
|
||||||
|
speed = newSpeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CheckFrameRate(void)
|
void CheckFrameRate(void)
|
||||||
{
|
{
|
||||||
if(UseFrameSkip) // skipping mode?
|
if(UseFrameSkip) // skipping mode?
|
||||||
|
@ -74,6 +82,7 @@ void FrameCap (void)
|
||||||
{
|
{
|
||||||
static unsigned long curticks, lastticks, _ticks_since_last_update;
|
static unsigned long curticks, lastticks, _ticks_since_last_update;
|
||||||
static unsigned int TicksToWait = 0;
|
static unsigned int TicksToWait = 0;
|
||||||
|
unsigned int frTicks = dwFrameRateTicks / speed;
|
||||||
int overslept=0, tickstogo=0;
|
int overslept=0, tickstogo=0;
|
||||||
BOOL Waiting = TRUE;
|
BOOL Waiting = TRUE;
|
||||||
|
|
||||||
|
@ -86,10 +95,10 @@ void FrameCap (void)
|
||||||
{
|
{
|
||||||
lastticks = curticks;
|
lastticks = curticks;
|
||||||
overslept = _ticks_since_last_update - TicksToWait;
|
overslept = _ticks_since_last_update - TicksToWait;
|
||||||
if((_ticks_since_last_update-TicksToWait) > dwFrameRateTicks)
|
if((_ticks_since_last_update-TicksToWait) > frTicks)
|
||||||
TicksToWait=0;
|
TicksToWait=0;
|
||||||
else
|
else
|
||||||
TicksToWait=dwFrameRateTicks - overslept;
|
TicksToWait=frTicks - overslept;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -104,7 +113,7 @@ void FrameCap (void)
|
||||||
Waiting = FALSE;
|
Waiting = FALSE;
|
||||||
lastticks = curticks;
|
lastticks = curticks;
|
||||||
overslept = _ticks_since_last_update - TicksToWait;
|
overslept = _ticks_since_last_update - TicksToWait;
|
||||||
TicksToWait = dwFrameRateTicks - overslept;
|
TicksToWait = frTicks - overslept;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tickstogo >= 200 && !(dwActFixes&16))
|
if (tickstogo >= 200 && !(dwActFixes&16))
|
||||||
|
@ -123,6 +132,7 @@ void FrameSkip(void)
|
||||||
static DWORD curticks, lastticks, _ticks_since_last_update;
|
static DWORD curticks, lastticks, _ticks_since_last_update;
|
||||||
int tickstogo=0;
|
int tickstogo=0;
|
||||||
static int overslept=0;
|
static int overslept=0;
|
||||||
|
unsigned int frTicks = dwFrameRateTicks / speed;
|
||||||
|
|
||||||
if(!dwLaceCnt) return; // important: if no updatelace happened, we ignore it completely
|
if(!dwLaceCnt) return; // important: if no updatelace happened, we ignore it completely
|
||||||
|
|
||||||
|
@ -146,12 +156,12 @@ void FrameSkip(void)
|
||||||
curticks = timeGetTime(); // -> now we calc the time of the last drawn frame + the time we spent skipping
|
curticks = timeGetTime(); // -> now we calc the time of the last drawn frame + the time we spent skipping
|
||||||
_ticks_since_last_update= dwT+curticks - lastticks;
|
_ticks_since_last_update= dwT+curticks - lastticks;
|
||||||
|
|
||||||
dwWaitTime=dwLastLace*dwFrameRateTicks; // -> and now we calc the time the real psx would have needed
|
dwWaitTime=dwLastLace*frTicks; // -> and now we calc the time the real psx would have needed
|
||||||
|
|
||||||
if(_ticks_since_last_update<dwWaitTime) // -> we were too fast?
|
if(_ticks_since_last_update<dwWaitTime) // -> we were too fast?
|
||||||
{
|
{
|
||||||
if((dwWaitTime-_ticks_since_last_update)> // -> some more security, to prevent
|
if((dwWaitTime-_ticks_since_last_update)> // -> some more security, to prevent
|
||||||
(60*dwFrameRateTicks)) // wrong waiting times
|
(60*frTicks)) // wrong waiting times
|
||||||
_ticks_since_last_update=dwWaitTime;
|
_ticks_since_last_update=dwWaitTime;
|
||||||
|
|
||||||
while(_ticks_since_last_update<dwWaitTime) // -> loop until we have reached the real psx time
|
while(_ticks_since_last_update<dwWaitTime) // -> loop until we have reached the real psx time
|
||||||
|
@ -188,7 +198,7 @@ void FrameSkip(void)
|
||||||
_ticks_since_last_update = curticks - lastticks;
|
_ticks_since_last_update = curticks - lastticks;
|
||||||
|
|
||||||
dwLastLace=dwLaceCnt; // store curr count (frame limitation helper)
|
dwLastLace=dwLaceCnt; // store curr count (frame limitation helper)
|
||||||
dwWaitTime=dwLaceCnt*dwFrameRateTicks; // calc the 'real psx lace time'
|
dwWaitTime=dwLaceCnt*frTicks; // calc the 'real psx lace time'
|
||||||
if (dwWaitTime >= overslept)
|
if (dwWaitTime >= overslept)
|
||||||
dwWaitTime-=overslept;
|
dwWaitTime-=overslept;
|
||||||
|
|
||||||
|
|
|
@ -2219,46 +2219,53 @@ void CALLBACK GPUgetScreenPic(unsigned char * pMem)
|
||||||
|
|
||||||
// LINUX version:
|
// LINUX version:
|
||||||
|
|
||||||
extern char * Xpixels;
|
|
||||||
|
|
||||||
void GPUgetScreenPic(unsigned char * pMem)
|
void GPUgetScreenPic(unsigned char * pMem)
|
||||||
{
|
{
|
||||||
/*
|
unsigned char *pf=pMem;
|
||||||
unsigned short c;unsigned char * pf;int x,y;
|
unsigned char *buf, *line, *pD;
|
||||||
|
|
||||||
float XS=(float)iResX/128;
|
int w = PreviousPSXDisplay.Range.x1, h = PreviousPSXDisplay.DisplayMode.y;
|
||||||
float YS=(float)iResY/96;
|
int x, y;
|
||||||
|
float XS = w / 128.0, YS = h / 96.0;
|
||||||
pf=pMem;
|
line = pf;
|
||||||
memset(pMem, 0, 128*96*3);
|
for (y = 0; y < 96; ++y) {
|
||||||
|
for (x = 0; x < 128; ++x) {
|
||||||
if(Xpixels)
|
float r = 0, g = 0, b = 0, sr, sg, sb;
|
||||||
{
|
uint32_t cnt = 0, i, j;
|
||||||
unsigned char * ps=(unsigned char *)Xpixels;
|
for (j = 0; j < (int)((y+1)*YS) - (int)(y*YS); ++j) {
|
||||||
{
|
for (i = 0; i < (int)((x+1)*XS) - (int)(x*XS); ++i) {
|
||||||
long lPitch=iResX<<2;
|
pD = (unsigned char *)&psxVuw[(int)(y*YS +
|
||||||
uint32_t sx;
|
PSXDisplay.DisplayPosition.y - 1 + j) * 1024 +
|
||||||
|
PSXDisplay.DisplayPosition.x] +
|
||||||
for(y=0;y<96;y++)
|
(PSXDisplay.RGB24 ? 3 : 2) * (int)(x*XS + i);
|
||||||
{
|
if (PSXDisplay.RGB24) {
|
||||||
for(x=0;x<128;x++)
|
uint32_t lu = *(uint32_t *)pD;
|
||||||
{
|
sr = RED(lu);
|
||||||
sx=*((uint32_t *)((ps)+
|
sg = GREEN(lu);
|
||||||
(((int)((float)y*YS))*lPitch)+
|
sb = BLUE(lu);
|
||||||
((int)((float)x*XS))*4));
|
} else {
|
||||||
*(pf+0)=(sx&0xff);
|
int32_t color = GETLE16(pD);
|
||||||
*(pf+1)=(sx&0xff00)>>8;
|
sr = (color << 3) & 0xf1;
|
||||||
*(pf+2)=(sx&0xff0000)>>16;
|
sg = (color >> 2) & 0xf1;
|
||||||
pf+=3;
|
sb = (color >> 7) & 0xf1;
|
||||||
}
|
}
|
||||||
|
r += sr * sr;
|
||||||
|
g += sg * sg;
|
||||||
|
b += sb * sb;
|
||||||
|
cnt += 1;
|
||||||
|
}
|
||||||
|
line[x * 3 + 2] = sqrt(r / cnt);
|
||||||
|
line[x * 3 + 1] = sqrt(g / cnt);
|
||||||
|
line[x * 3 + 0] = sqrt(b / cnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
line += 128 * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
// generic number/border painter
|
// generic number/border painter
|
||||||
|
|
||||||
|
unsigned short c;
|
||||||
pf=pMem+(103*3); // offset to number rect
|
pf=pMem+(103*3); // offset to number rect
|
||||||
|
|
||||||
for(y=0;y<20;y++) // loop the number rect pixel
|
for(y=0;y<20;y++) // loop the number rect pixel
|
||||||
|
@ -2289,7 +2296,6 @@ void GPUgetScreenPic(unsigned char * pMem)
|
||||||
*(pf+(127*3))=0xff;*pf++=0xff;
|
*(pf+(127*3))=0xff;*pf++=0xff;
|
||||||
pf+=127*3; // offset to next line
|
pf+=127*3; // offset to next line
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
BOOL bIsPerformanceCounter=FALSE;
|
BOOL bIsPerformanceCounter=FALSE;
|
||||||
float fFrameRateHz=0;
|
float fFrameRateHz=0;
|
||||||
|
float speed=1;
|
||||||
DWORD dwFrameRateTicks=16;
|
DWORD dwFrameRateTicks=16;
|
||||||
float fFrameRate;
|
float fFrameRate;
|
||||||
int iFrameLimit;
|
int iFrameLimit;
|
||||||
|
@ -64,7 +65,9 @@ void FrameCap(void)
|
||||||
{
|
{
|
||||||
static unsigned long curticks, lastticks, _ticks_since_last_update;
|
static unsigned long curticks, lastticks, _ticks_since_last_update;
|
||||||
static unsigned long TicksToWait = 0;
|
static unsigned long TicksToWait = 0;
|
||||||
|
double remTime;
|
||||||
bool Waiting = TRUE;
|
bool Waiting = TRUE;
|
||||||
|
DWORD frTicks=(DWORD)(dwFrameRateTicks / speed);
|
||||||
|
|
||||||
{
|
{
|
||||||
curticks = timeGetTime();
|
curticks = timeGetTime();
|
||||||
|
@ -75,9 +78,9 @@ void FrameCap(void)
|
||||||
{
|
{
|
||||||
lastticks = curticks;
|
lastticks = curticks;
|
||||||
|
|
||||||
if((_ticks_since_last_update-TicksToWait) > dwFrameRateTicks)
|
if((_ticks_since_last_update-TicksToWait) > frTicks)
|
||||||
TicksToWait=0;
|
TicksToWait=0;
|
||||||
else TicksToWait=dwFrameRateTicks-(_ticks_since_last_update-TicksToWait);
|
else TicksToWait=frTicks-(_ticks_since_last_update-TicksToWait);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -85,13 +88,18 @@ void FrameCap(void)
|
||||||
{
|
{
|
||||||
curticks = timeGetTime();
|
curticks = timeGetTime();
|
||||||
_ticks_since_last_update = curticks - lastticks;
|
_ticks_since_last_update = curticks - lastticks;
|
||||||
|
remTime = (TicksToWait - _ticks_since_last_update) * 1e6 / TIMEBASE;
|
||||||
if ((_ticks_since_last_update > TicksToWait) ||
|
if ((_ticks_since_last_update > TicksToWait) ||
|
||||||
(curticks < lastticks))
|
(curticks < lastticks))
|
||||||
{
|
{
|
||||||
Waiting = FALSE;
|
Waiting = FALSE;
|
||||||
lastticks = curticks;
|
lastticks = curticks;
|
||||||
TicksToWait = dwFrameRateTicks;
|
TicksToWait = frTicks;
|
||||||
}
|
}
|
||||||
|
else if (remTime > 2)
|
||||||
|
{
|
||||||
|
usleep(remTime - 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,9 +113,15 @@ void FrameSkip(void)
|
||||||
static int iNumSkips=0,iAdditionalSkip=0; // number of additional frames to skip
|
static int iNumSkips=0,iAdditionalSkip=0; // number of additional frames to skip
|
||||||
static DWORD dwLastLace=0; // helper var for frame limitation
|
static DWORD dwLastLace=0; // helper var for frame limitation
|
||||||
static DWORD curticks, lastticks, _ticks_since_last_update;
|
static DWORD curticks, lastticks, _ticks_since_last_update;
|
||||||
|
DWORD frTicks=(DWORD)(dwFrameRateTicks / speed);
|
||||||
|
double remTime;
|
||||||
|
DWORD maxSkipTicks = 0;
|
||||||
|
|
||||||
if(!dwLaceCnt) return; // important: if no updatelace happened, we ignore it completely
|
if(!dwLaceCnt) return; // important: if no updatelace happened, we ignore it completely
|
||||||
|
|
||||||
|
if (speed > 1) {
|
||||||
|
maxSkipTicks = 1/30. * TIMEBASE;
|
||||||
|
}
|
||||||
if(iNumSkips) // we are in skipping mode?
|
if(iNumSkips) // we are in skipping mode?
|
||||||
{
|
{
|
||||||
dwLastLace+=dwLaceCnt; // -> calc frame limit helper (number of laces)
|
dwLastLace+=dwLaceCnt; // -> calc frame limit helper (number of laces)
|
||||||
|
@ -128,23 +142,28 @@ void FrameSkip(void)
|
||||||
curticks = timeGetTime();
|
curticks = timeGetTime();
|
||||||
_ticks_since_last_update= dwT+curticks - lastticks;
|
_ticks_since_last_update= dwT+curticks - lastticks;
|
||||||
|
|
||||||
dwWaitTime=dwLastLace*dwFrameRateTicks; // -> and now we calc the time the real psx would have needed
|
dwWaitTime=dwLastLace*frTicks; // -> and now we calc the time the real psx would have needed
|
||||||
|
|
||||||
if(_ticks_since_last_update<dwWaitTime) // -> we were too fast?
|
if(_ticks_since_last_update<dwWaitTime) // -> we were too fast?
|
||||||
{
|
{
|
||||||
if((dwWaitTime-_ticks_since_last_update)> // -> some more security, to prevent
|
if((dwWaitTime-_ticks_since_last_update)> // -> some more security, to prevent
|
||||||
(60*dwFrameRateTicks)) // wrong waiting times
|
(60*frTicks)) // wrong waiting times
|
||||||
_ticks_since_last_update=dwWaitTime;
|
_ticks_since_last_update=dwWaitTime;
|
||||||
|
|
||||||
while(_ticks_since_last_update<dwWaitTime) // -> loop until we have reached the real psx time
|
while(_ticks_since_last_update<dwWaitTime) // -> loop until we have reached the real psx time
|
||||||
{ // (that's the additional limitation, yup)
|
{ // (that's the additional limitation, yup)
|
||||||
|
remTime = (dwWaitTime - _ticks_since_last_update) * 1e6 / TIMEBASE;
|
||||||
|
if (remTime > 2) {
|
||||||
|
usleep(remTime - 2);
|
||||||
|
}
|
||||||
curticks = timeGetTime();
|
curticks = timeGetTime();
|
||||||
_ticks_since_last_update = dwT+curticks - lastticks;
|
_ticks_since_last_update = dwT+curticks - lastticks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // we were still too slow ?!!?
|
else // we were still too slow ?!!?
|
||||||
{
|
{
|
||||||
if(iAdditionalSkip<MAXSKIP) // -> well, somewhen we really have to stop skipping on very slow systems
|
if(iAdditionalSkip<MAXSKIP &&
|
||||||
|
_ticks_since_last_update<maxSkipTicks) // -> well, somewhen we really have to stop skipping on very slow systems
|
||||||
{
|
{
|
||||||
iAdditionalSkip++; // -> inc our watchdog var
|
iAdditionalSkip++; // -> inc our watchdog var
|
||||||
dwLaceCnt=0; // -> reset lace count
|
dwLaceCnt=0; // -> reset lace count
|
||||||
|
@ -170,7 +189,7 @@ void FrameSkip(void)
|
||||||
_ticks_since_last_update = curticks - lastticks;
|
_ticks_since_last_update = curticks - lastticks;
|
||||||
|
|
||||||
dwLastLace=dwLaceCnt; // store curr count (frame limitation helper)
|
dwLastLace=dwLaceCnt; // store curr count (frame limitation helper)
|
||||||
dwWaitTime=dwLaceCnt*dwFrameRateTicks; // calc the 'real psx lace time'
|
dwWaitTime=dwLaceCnt*frTicks; // calc the 'real psx lace time'
|
||||||
|
|
||||||
if(_ticks_since_last_update>dwWaitTime) // hey, we needed way too long for that frame...
|
if(_ticks_since_last_update>dwWaitTime) // hey, we needed way too long for that frame...
|
||||||
{
|
{
|
||||||
|
@ -194,6 +213,10 @@ void FrameSkip(void)
|
||||||
|
|
||||||
while(_ticks_since_last_update<dwWaitTime) // just do a waiting loop...
|
while(_ticks_since_last_update<dwWaitTime) // just do a waiting loop...
|
||||||
{
|
{
|
||||||
|
remTime = (dwWaitTime - _ticks_since_last_update) * 1e6 / TIMEBASE;
|
||||||
|
if (remTime > 2) {
|
||||||
|
usleep(remTime - 2);
|
||||||
|
}
|
||||||
curticks = timeGetTime();
|
curticks = timeGetTime();
|
||||||
_ticks_since_last_update = curticks - lastticks;
|
_ticks_since_last_update = curticks - lastticks;
|
||||||
}
|
}
|
||||||
|
@ -247,8 +270,8 @@ void calcfps(void)
|
||||||
fps_cnt = 0;
|
fps_cnt = 0;
|
||||||
fps_tck = 1;
|
fps_tck = 1;
|
||||||
|
|
||||||
if(bUseFrameLimit && fps_cur>fFrameRateHz) // optical adjust ;) avoids flickering fps display
|
if(bUseFrameLimit && fps_cur>fFrameRateHz * speed) // optical adjust ;) avoids flickering fps display
|
||||||
fps_cur=fFrameRateHz;
|
fps_cur=fFrameRateHz * speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +290,7 @@ void PCFrameCap (void)
|
||||||
{
|
{
|
||||||
Waiting = FALSE;
|
Waiting = FALSE;
|
||||||
lastticks = curticks;
|
lastticks = curticks;
|
||||||
TicksToWait = (TIMEBASE / (unsigned long)fFrameRateHz);
|
TicksToWait = (TIMEBASE / (unsigned long)(fFrameRateHz * speed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,6 +403,12 @@ void CheckFrameRate(void) // called in updatelace (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CALLBACK GPUsetSpeed(float newSpeed) {
|
||||||
|
if (newSpeed > 0 && newSpeed <= 1000) {
|
||||||
|
speed = newSpeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CALLBACK GPUsetframelimit(unsigned long option) // new EPSXE interface func: main emu can enable/disable fps limitation this way
|
void CALLBACK GPUsetframelimit(unsigned long option) // new EPSXE interface func: main emu can enable/disable fps limitation this way
|
||||||
{
|
{
|
||||||
bInitCap = TRUE;
|
bInitCap = TRUE;
|
||||||
|
|
|
@ -98,7 +98,7 @@ BEGIN
|
||||||
CTEXT "PCSXR EMU\nVersion x.x",IDC_PCSXR_ABOUT_TEXT,22,10,112,15,0,WS_EX_TRANSPARENT
|
CTEXT "PCSXR EMU\nVersion x.x",IDC_PCSXR_ABOUT_TEXT,22,10,112,15,0,WS_EX_TRANSPARENT
|
||||||
CTEXT "PCSXR a psx emulator...",IDC_PCSXR_ABOUT_AUTHORS,10,35,135,63,0,WS_EX_TRANSPARENT
|
CTEXT "PCSXR a psx emulator...",IDC_PCSXR_ABOUT_AUTHORS,10,35,135,63,0,WS_EX_TRANSPARENT
|
||||||
CTEXT "Greets to...",IDC_PCSXR_ABOUT_GREETS,45,110,232,65
|
CTEXT "Greets to...",IDC_PCSXR_ABOUT_GREETS,45,110,232,65
|
||||||
CONTROL SPLASH_LOGO,IDC_STATIC,"Static",SS_BITMAP | WS_BORDER,155,10,171,101
|
CONTROL 113,IDC_STATIC,"Static",SS_BITMAP | WS_BORDER,155,10,171,101
|
||||||
GROUPBOX "",IDC_STATIC,5,25,145,77
|
GROUPBOX "",IDC_STATIC,5,25,145,77
|
||||||
GROUPBOX "",IDC_STATIC,43,100,234,79
|
GROUPBOX "",IDC_STATIC,43,100,234,79
|
||||||
END
|
END
|
||||||
|
@ -350,16 +350,20 @@ END
|
||||||
// remains consistent on all systems.
|
// remains consistent on all systems.
|
||||||
IDI_APP_ICON ICON "gui\\pcsxr.ico"
|
IDI_APP_ICON ICON "gui\\pcsxr.ico"
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Bitmap
|
// Bitmap
|
||||||
//
|
//
|
||||||
|
|
||||||
SPLASH_LOGO BITMAP "gui\\about.bmp"
|
SPLASH_LOGO BITMAP "gui\\about.bmp"
|
||||||
|
|
||||||
MAIN_LOGO BITMAP "gui\\pcsxr.bmp"
|
MAIN_LOGO BITMAP "gui\\pcsxr.bmp"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// RT_MANIFEST
|
||||||
|
//
|
||||||
|
|
||||||
|
1 RT_MANIFEST "gui\\pcsxr.exe.manifest"
|
||||||
#endif // English (United States) resources
|
#endif // English (United States) resources
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,9 @@
|
||||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<EmbedManifest>false</EmbedManifest>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Midl>
|
<Midl>
|
||||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|
Loading…
Reference in New Issue