merge from libretro fork

+ minor modifications

Reducing the diff as it's too hard to track down breakage
when one works but not the other.
This commit is contained in:
notaz
2022-10-15 23:12:50 +03:00
parent acc415b304
commit 7a8d521fba
72 changed files with 5689 additions and 3081 deletions
+5
View File
@@ -1,3 +1,8 @@
#ifndef __BLIT320_H__
#define __BLIT320_H__
void blit320_640(void *dst, const void *src, int unused);
void blit320_512(void *dst, const void *src, int unused);
void blit320_368(void *dst, const void *src, int unused);
#endif /* __BLIT320_H__ */
+5
View File
@@ -1,3 +1,6 @@
#ifndef __CSPACE_H__
#define __CSPACE_H__
#ifdef __cplusplus
extern "C"
{
@@ -19,3 +22,5 @@ void bgr888_to_uyvy(void *d, const void *s, int pixels);
#ifdef __cplusplus
}
#endif
#endif /* __CSPACE_H__ */
+5
View File
@@ -1 +1,6 @@
#ifndef __IN_TSBUTTON_H__
#define __IN_TSBUTTON_H__
void in_tsbutton_init(void);
#endif /* __IN_TSBUTTON_H__ */
+2640 -809
View File
File diff suppressed because it is too large Load Diff
-1926
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+552
View File
@@ -0,0 +1,552 @@
#ifndef LIBRETRO_CORE_OPTIONS_INTL_H__
#define LIBRETRO_CORE_OPTIONS_INTL_H__
#if defined(_MSC_VER) && (_MSC_VER >= 1500 && _MSC_VER < 1900)
/* https://support.microsoft.com/en-us/kb/980263 */
#pragma execution_character_set("utf-8")
#pragma warning(disable:4566)
#endif
#include <libretro.h>
/*
********************************
* VERSION: 2.0
********************************
*
* - 2.0: Add support for core options v2 interface
* - 1.3: Move translations to libretro_core_options_intl.h
* - libretro_core_options_intl.h includes BOM and utf-8
* fix for MSVC 2010-2013
* - Added HAVE_NO_LANGEXTRA flag to disable translations
* on platforms/compilers without BOM support
* - 1.2: Use core options v1 interface when
* RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION is >= 1
* (previously required RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION == 1)
* - 1.1: Support generation of core options v0 retro_core_option_value
* arrays containing options with a single value
* - 1.0: First commit
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
********************************
* Core Option Definitions
********************************
*/
/* RETRO_LANGUAGE_JAPANESE */
/* RETRO_LANGUAGE_FRENCH */
/* RETRO_LANGUAGE_SPANISH */
/* RETRO_LANGUAGE_GERMAN */
/* RETRO_LANGUAGE_ITALIAN */
/* RETRO_LANGUAGE_DUTCH */
/* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
/* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
/* RETRO_LANGUAGE_RUSSIAN */
/* RETRO_LANGUAGE_KOREAN */
/* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
/* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
/* RETRO_LANGUAGE_ESPERANTO */
/* RETRO_LANGUAGE_POLISH */
/* RETRO_LANGUAGE_VIETNAMESE */
/* RETRO_LANGUAGE_ARABIC */
/* RETRO_LANGUAGE_GREEK */
/* RETRO_LANGUAGE_TURKISH */
struct retro_core_option_v2_category option_cats_tr[] = {
{ NULL, NULL, NULL },
};
struct retro_core_option_v2_definition option_defs_tr[] = {
{
"pcsx_rearmed_frameskip",
"Kare Atlama",
NULL,
"Görsel pürüzsüzlük pahasına performansı artırmak için ne kadar karenin atlanması gerektiğini seçin.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_bios",
"BIOS Kullan",
NULL,
"Gerçek bios dosyasını (varsa) veya öykünmüş bios'u (HLE) kullanmanızı sağlar. Daha iyi uyumluluk için resmi bios dosyasını kullanmanız önerilir.",
NULL,
NULL,
{
{ "auto", "otomatik" },
{ NULL, NULL },
},
"auto",
},
{
"pcsx_rearmed_region",
"Bölge",
NULL,
"Sistemin hangi bölgeden olduğunu seçin. NTSC için 60 Hz, PAL için 50 Hz.",
NULL,
NULL,
{
{ "auto", "otomatik" },
{ NULL, NULL },
},
"auto",
},
{
"pcsx_rearmed_memcard2",
"İkinci Bellek Kartını Etkinleştir (Paylaşılan)",
NULL,
"2. Hafıza kartı yuvasını etkinleştirin. Bu hafıza kartı tüm oyunlar arasında paylaşılır.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_multitap1",
"Multitap 1",
NULL,
"Bağlantı noktası 1'deki multitap'ı etkinleştirir / devre dışı bırakır ve izin veren oyunlarda 5 oyuncuya kadar izin verir.",
NULL,
NULL,
{
{ "auto", "otomatik" },
{ NULL, NULL },
},
"auto",
},
{
"pcsx_rearmed_multitap2",
"Multitap 2",
NULL,
"Bağlantı noktası 2'deki multitap'ı etkinleştirir/devre dışı bırakır ve izin veren oyunlarda 8 oyuncuya kadar izin verir. Bunun çalışması için Multitap 1'in etkinleştirilmesi gerekir.",
NULL,
NULL,
{
{ "auto", "otomatik" },
{ NULL, NULL },
},
"auto",
},
{
"pcsx_rearmed_negcon_deadzone",
"NegCon Twist Deadzone (Yüzdelik)",
NULL,
"Öykünülmüş neGcon kontrolörünün 'büküm' eylemini simüle ederken RetroPad sol analog çubuğunun ölü bölgesini ayarlar. Sürüklenme/istenmeyen girişi ortadan kaldırmak için kullanılır.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_negcon_response",
"NegCon Twist Response",
NULL,
"Öykünülmüş neGcon kontrolörünün 'bükümünü' simule etmek için bir RetroPad sol analog çubuğu kullanırken analog cevabını belirtir.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_vibration",
"Titreşimi Etkinleştir",
NULL,
"Titreşim özelliklerini destekleyen kontrolörler için titreşim geri bildirimini etkinleştirir.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_dithering",
"Dithering Etkinleştir",
NULL,
"Kapalı ise, PSX'in renk bantlarıyla mücadele etmek için uyguladığı renk taklidi düzenini devre dışı bırakır.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
#ifdef NEW_DYNAREC
{
"pcsx_rearmed_drc",
"Dinamik Yeniden Derleyici",
NULL,
"Çekirdeğin dinamik yeniden derleyici veya tercüman(daha yavaş) CPU talimatlarını kullanmasını sağlar.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_psxclock",
"PSX CPU Saat Hızı",
NULL,
#if defined(HAVE_PRE_ARMV7) && !defined(_3DS)
"Overclock or underclock the PSX clock. Default is 50",
#else
"Overclock or underclock the PSX clock. Default is 57",
#endif
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
#endif /* NEW_DYNAREC */
#ifdef GPU_NEON
{
"pcsx_rearmed_neon_interlace_enable",
"Interlacing Mode'u etkinleştir",
NULL,
"Sahte tarama çizgileri efektini etkinleştirir.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_neon_enhancement_enable",
"Geliştirilmiş Çözünürlük (Yavaş)",
NULL,
"Düşük performans pahasına çift çözünürlükte işler.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_neon_enhancement_no_main",
"Geliştirilmiş Çözünürlük (Speed Hack)",
NULL,
"Geliştirilmiş çözünürlük seçeneği için hız aşırtma(bazı oyunlarda sorun çıkartabilir).",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
#endif /* GPU_NEON */
{
"pcsx_rearmed_duping_enable",
"Frame Duping",
NULL,
"Yeni bir veri yoksa, bir hızlandırma, son kareyi yeniden çizer/yeniden kullanır.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_display_internal_fps",
"Dahili FPS'yi görüntüle",
NULL,
"Etkinleştirildiğinde ekranda saniye başına kareyi gösterir.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
/* GPU PEOPS OPTIONS */
#ifdef GPU_PEOPS
{
"pcsx_rearmed_show_gpu_peops_settings",
"Gelişmiş GPU Ayarlarını Göster",
NULL,
"Çeşitli GPU düzeltmelerini etkinleştirin veya devre dışı bırakın. Ayarların etkili olması için core'un yeniden başlatılması gerekebilir. NOT: Bu ayarın etkili olabilmesi için Hızlı Menü’nün değiştirilmesi gerekir.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_gpu_peops_odd_even_bit",
"(GPU) Odd/Even Bit Hack",
NULL,
"Chrono Cross için gerekli.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_gpu_peops_expand_screen_width",
"(GPU) Ekran Genişliğini Genişlet",
NULL,
"Capcom dövüş oyunları",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_gpu_peops_ignore_brightness",
"(GPU) Parlaklık Rengini Yoksay",
NULL,
"Lunar Silver Star Story oyunlarında siyah ekran",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_gpu_peops_disable_coord_check",
"(GPU) Koordinat Kontrolünü Devre Dışı Bırak",
NULL,
"Uyumluluk modu",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_gpu_peops_lazy_screen_update",
"(GPU) Tembel Ekran Güncellemesi",
NULL,
"Pandemonium 2",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_gpu_peops_old_frame_skip",
"(GPU) Eski Çerçeve Atlama",
NULL,
"Her ikinci kareyi atla",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_gpu_peops_repeated_triangles",
"(GPU) Tekrarlanan Düz Doku Üçgenleri",
NULL,
"Star Wars: Dark Forces için gerekli",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_gpu_peops_quads_with_triangles",
"(GPU) Üçgenler ile Dörtlü Çiz",
NULL,
"Daha iyi g renkler, daha kötü dokular",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_gpu_peops_fake_busy_state",
"(GPU) Sahte 'Gpu Meşgul' Konumları",
NULL,
"Çizimden sonra meşgul bayraklarını değiştir",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
#endif /* GPU_PEOPS */
{
"pcsx_rearmed_show_bios_bootlogo",
"Bios Bootlogo'yu Göster",
NULL,
"Etkinleştirildiğinde, başlatırken veya sıfırlarken PlayStation logosunu gösterir. (Bazı oyunları bozabilir).",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_spu_reverb",
"Ses Yankısı",
NULL,
"Ses yankı efektini etkinleştirir veya devre dışı bırakır.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_spu_interpolation",
"Ses Enterpolasyonu",
NULL,
NULL,
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_icache_emulation",
"ICache Düzeltmleri",
NULL,
NULL,
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
/* ADVANCED OPTIONS */
{
"pcsx_rearmed_noxadecoding",
"XA Kod Çözme",
NULL,
NULL,
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_nocdaudio",
"CD Ses",
NULL,
NULL,
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
#ifdef NEW_DYNAREC
{
"pcsx_rearmed_nosmccheck",
"(Speed Hack) SMC Kontrollerini Devre Dışı Bırak",
NULL,
"Yükleme sırasında çökmelere neden olabilir, hafıza kartını bozabilir.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_gteregsunneeded",
"(Speed Hack) GTE'nin Gereksiz Olduğunu Varsayın",
NULL,
"Grafiksel bozukluklara neden olabilir.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
{
"pcsx_rearmed_nogteflags",
"(Speed Hack) GTE Bayraklarını Devredışı Bırakın",
NULL,
"Grafiksel bozukluklara neden olur.",
NULL,
NULL,
{
{ NULL, NULL },
},
NULL
},
#endif /* NEW_DYNAREC */
{ NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL },
};
struct retro_core_options_v2 options_tr = {
option_cats_tr,
option_defs_tr
};
#ifdef __cplusplus
}
#endif
#endif
+5
View File
@@ -0,0 +1,5 @@
{
global: retro_*;
local: *;
};
+22 -16
View File
@@ -11,7 +11,7 @@
#include <unistd.h>
#include <signal.h>
#include <time.h>
#ifndef _WIN32
#if !defined(_WIN32) && !defined(NO_DYLIB)
#include <dlfcn.h>
#endif
@@ -158,15 +158,17 @@ void emu_set_default_config(void)
spu_config.iVolume = 768;
spu_config.iTempo = 0;
spu_config.iUseThread = 1; // no effect if only 1 core is detected
#ifdef HAVE_PRE_ARMV7 /* XXX GPH hack */
#if defined(HAVE_PRE_ARMV7) && !defined(_3DS) /* XXX GPH hack */
spu_config.iUseReverb = 0;
spu_config.iUseInterpolation = 0;
#ifndef HAVE_LIBRETRO
spu_config.iTempo = 1;
#endif
#endif
new_dynarec_hacks = 0;
in_type1 = PSE_PAD_TYPE_STANDARD;
in_type2 = PSE_PAD_TYPE_STANDARD;
in_type[0] = PSE_PAD_TYPE_STANDARD;
in_type[1] = PSE_PAD_TYPE_STANDARD;
}
void do_emu_action(void)
@@ -313,7 +315,7 @@ static int cdidcmp(const char *id1, const char *id2)
static void parse_cwcheat(void)
{
char line[256], buf[64], name[64], *p;
char line[256], buf[256], name[256], *p;
int newcheat = 1;
u32 a, v;
FILE *f;
@@ -755,10 +757,10 @@ void SysReset() {
// reset can run code, timing must be set
pl_timing_prepare(Config.PsxType);
EmuReset();
// hmh core forgets this
CDR_stop();
EmuReset();
GPU_updateLace = real_lace;
g_emu_resetting = 0;
@@ -806,7 +808,7 @@ int emu_save_state(int slot)
return ret;
ret = SaveState(fname);
#ifdef HAVE_PRE_ARMV7 /* XXX GPH hack */
#if defined(HAVE_PRE_ARMV7) && !defined(_3DS) && !defined(__SWITCH__) /* XXX GPH hack */
sync();
#endif
SysPrintf("* %s \"%s\" [%d]\n",
@@ -828,6 +830,7 @@ int emu_load_state(int slot)
return LoadState(fname);
}
#ifndef HAVE_LIBRETRO
#ifndef ANDROID
void SysPrintf(const char *fmt, ...) {
@@ -852,6 +855,7 @@ void SysPrintf(const char *fmt, ...) {
}
#endif
#endif /* HAVE_LIBRETRO */
void SysMessage(const char *fmt, ...) {
va_list list;
@@ -901,14 +905,15 @@ static int _OpenPlugins(void) {
if (Config.UseNet && !NetOpened) {
netInfo info;
char path[MAXPATHLEN];
char path[MAXPATHLEN * 2];
char dotdir[MAXPATHLEN];
MAKE_PATH(dotdir, "/.pcsx/plugins/", NULL);
strcpy(info.EmuName, "PCSX");
strncpy(info.CdromID, CdromId, 9);
strncpy(info.CdromLabel, CdromLabel, 9);
memcpy(info.CdromID, CdromId, 9); /* no \0 trailing character? */
memcpy(info.CdromLabel, CdromLabel, 9);
info.CdromLabel[9] = '\0';
info.psxMem = psxM;
info.GPU_showScreenPic = GPU_showScreenPic;
info.GPU_displayText = GPU_displayText;
@@ -1020,7 +1025,7 @@ void *SysLoadLibrary(const char *lib) {
return (void *)(uintptr_t)(PLUGIN_DL_BASE + builtin_plugin_ids[i]);
}
#ifndef _WIN32
#if !defined(_WIN32) && !defined(NO_DYLIB)
ret = dlopen(lib, RTLD_NOW);
if (ret == NULL)
SysMessage("dlopen: %s", dlerror());
@@ -1037,7 +1042,7 @@ void *SysLoadSym(void *lib, const char *sym) {
if (PLUGIN_DL_BASE <= plugid && plugid < PLUGIN_DL_BASE + ARRAY_SIZE(builtin_plugins))
return plugin_link(plugid - PLUGIN_DL_BASE, sym);
#ifndef _WIN32
#if !defined(_WIN32) && !defined(NO_DYLIB)
return dlsym(lib, sym);
#else
return NULL;
@@ -1045,7 +1050,9 @@ void *SysLoadSym(void *lib, const char *sym) {
}
const char *SysLibError() {
#ifndef _WIN32
#if defined(NO_DYLIB)
return NULL;
#elif !defined(_WIN32)
return dlerror();
#else
return "not supported";
@@ -1058,8 +1065,7 @@ void SysCloseLibrary(void *lib) {
if (PLUGIN_DL_BASE <= plugid && plugid < PLUGIN_DL_BASE + ARRAY_SIZE(builtin_plugins))
return;
#ifndef _WIN32
#if !defined(_WIN32) && !defined(NO_DYLIB)
dlclose(lib);
#endif
}
+6 -6
View File
@@ -309,14 +309,14 @@ static void menu_sync_config(void)
Config.cycle_multiplier = 10000 / psx_clock;
switch (in_type_sel1) {
case 1: in_type1 = PSE_PAD_TYPE_ANALOGPAD; break;
case 2: in_type1 = PSE_PAD_TYPE_GUNCON; break;
default: in_type1 = PSE_PAD_TYPE_STANDARD;
case 1: in_type[0] = PSE_PAD_TYPE_ANALOGPAD; break;
case 2: in_type[0] = PSE_PAD_TYPE_NEGCON; break;
default: in_type[0] = PSE_PAD_TYPE_STANDARD;
}
switch (in_type_sel2) {
case 1: in_type2 = PSE_PAD_TYPE_ANALOGPAD; break;
case 2: in_type2 = PSE_PAD_TYPE_GUNCON; break;
default: in_type2 = PSE_PAD_TYPE_STANDARD;
case 1: in_type[1] = PSE_PAD_TYPE_ANALOGPAD; break;
case 2: in_type[1] = PSE_PAD_TYPE_NEGCON; break;
default: in_type[1] = PSE_PAD_TYPE_STANDARD;
}
if (in_evdev_allow_abs_only != allow_abs_only_old) {
in_probe();
+5
View File
@@ -1,3 +1,6 @@
#ifndef __MENU_H__
#define __MENU_H__
void menu_init(void);
void menu_prepare_emu(void);
void menu_loop(void);
@@ -35,3 +38,5 @@ extern int soft_filter;
extern int g_menuscreen_w;
extern int g_menuscreen_h;
#endif /* __MENU_H__ */
+4 -1
View File
@@ -1,3 +1,6 @@
#ifndef __NOPIC_H__
#define __NOPIC_H__
/* these are just deps, to be removed */
static const struct {
@@ -54,4 +57,4 @@ void DrawNumBorPic(unsigned char *pMem, int lSelectedSlot)
}
}
#endif /* __NOPIC_H__ */
+5
View File
@@ -1,3 +1,6 @@
#ifndef __PL_GUN_TS_H__
#define __PL_GUN_TS_H__
#ifdef HAVE_TSLIB
struct tsdev;
@@ -16,3 +19,5 @@ int pl_gun_ts_get_fd(struct tsdev *ts);
#define pl_set_gun_rect(...) do {} while (0)
#endif
#endif /* __PL_GUN_TS_H__ */
+5
View File
@@ -1,3 +1,6 @@
#ifndef __PLAT_H__
#define __PLAT_H__
void plat_init(void);
void plat_finish(void);
void plat_minimize(void);
@@ -8,3 +11,5 @@ void plat_gvideo_open(int is_pal);
void *plat_gvideo_set_mode(int *w, int *h, int *bpp);
void *plat_gvideo_flip(void);
void plat_gvideo_close(void);
#endif /* __PLAT_H__ */
+3
View File
@@ -1,5 +1,8 @@
#ifndef __PLAT_OMAP_H__
#define __PLAT_OMAP_H__
void plat_omap_init(void);
void plat_omap_finish(void);
void plat_omap_gvideo_open(void);
#endif /* __PLAT_OMAP_H__ */
+9 -9
View File
@@ -48,21 +48,21 @@ extern int CALLBACK SPUplayCDDAchannel(short *, int, unsigned int, int);
/* PAD */
static long CALLBACK PADreadPort1(PadDataS *pad)
{
pad->controllerType = in_type1;
pad->buttonStatus = ~in_keystate;
if (in_type1 == PSE_PAD_TYPE_ANALOGPAD) {
pad->leftJoyX = in_a1[0];
pad->leftJoyY = in_a1[1];
pad->rightJoyX = in_a2[0];
pad->rightJoyY = in_a2[1];
pad->controllerType = in_type[0];
pad->buttonStatus = ~in_keystate[0];
if (in_type[0] == PSE_PAD_TYPE_ANALOGPAD) {
pad->leftJoyX = in_analog_left[0][0];
pad->leftJoyY = in_analog_left[0][1];
pad->rightJoyX = in_analog_right[0][0];
pad->rightJoyY = in_analog_right[0][1];
}
return 0;
}
static long CALLBACK PADreadPort2(PadDataS *pad)
{
pad->controllerType = in_type2;
pad->buttonStatus = ~in_keystate >> 16;
pad->controllerType = in_type[1];
pad->buttonStatus = ~in_keystate[0] >> 16;
return 0;
}
+5
View File
@@ -1,3 +1,6 @@
#ifndef __PLUGIN_H__
#define __PLUGIN_H__
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#define PLUGIN_DL_BASE 0xfbad0000
@@ -12,3 +15,5 @@ enum builtint_plugins_e {
void *plugin_link(enum builtint_plugins_e id, const char *sym);
void plugin_call_rearmed_cbs(void);
#endif /* __PLUGIN_H__ */
+11 -7
View File
@@ -36,11 +36,16 @@
#define HUD_HEIGHT 10
int in_type1, in_type2;
int in_a1[2] = { 127, 127 }, in_a2[2] = { 127, 127 };
int in_type[8];
int multitap1;
int multitap2;
int in_analog_left[8][2] = {{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 }};
int in_analog_right[8][2] = {{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 }};
int in_adev[2] = { -1, -1 }, in_adev_axis[2][2] = {{ 0, 1 }, { 0, 1 }};
int in_adev_is_nublike[2];
int in_keystate, in_state_gun;
unsigned short in_keystate[8];
int in_mouse[8][2];
int in_state_gun;
int in_enable_vibration;
void *tsdev;
void *pl_vout_buf;
@@ -567,7 +572,7 @@ static void update_analog_nub_adjust(int *x_, int *y_)
static void update_analogs(void)
{
int *nubp[2] = { in_a1, in_a2 };
int *nubp[2] = { in_analog_left[0], in_analog_right[0] };
int vals[2];
int i, a, v, ret;
@@ -595,7 +600,6 @@ static void update_analogs(void)
}
}
//printf("%4d %4d %4d %4d\n", in_a1[0], in_a1[1], in_a2[0], in_a2[1]);
}
static void update_input(void)
@@ -604,7 +608,7 @@ static void update_input(void)
unsigned int emu_act;
in_update(actions);
if (in_type1 == PSE_PAD_TYPE_ANALOGPAD)
if (in_type[0] == PSE_PAD_TYPE_ANALOGJOY || in_type[0] == PSE_PAD_TYPE_ANALOGPAD)
update_analogs();
emu_act = actions[IN_BINDTYPE_EMU];
in_state_gun = (emu_act & SACTION_GUN_MASK) >> SACTION_GUN_TRIGGER;
@@ -618,7 +622,7 @@ static void update_input(void)
}
emu_set_action(emu_act);
in_keystate = actions[IN_BINDTYPE_PLAYER12];
in_keystate[0] = actions[IN_BINDTYPE_PLAYER12];
}
#else /* MAEMO */
extern void update_input(void);
+17 -2
View File
@@ -1,3 +1,9 @@
#ifndef __PLUGIN_LIB_H__
#define __PLUGIN_LIB_H__
#define THREAD_RENDERING_OFF 0
#define THREAD_RENDERING_SYNC 1
#define THREAD_RENDERING_ASYNC 2
enum {
DKEY_SELECT = 0,
@@ -17,8 +23,15 @@ enum {
DKEY_CROSS,
DKEY_SQUARE,
};
extern int in_type1, in_type2;
extern int in_keystate, in_state_gun, in_a1[2], in_a2[2];
extern int in_state_gun;
extern int in_type[8];
extern int multitap1;
extern int multitap2;
extern int in_analog_left[8][2];
extern int in_analog_right[8][2];
extern unsigned short in_keystate[8];
extern int in_mouse[8][2];
extern int in_adev[2], in_adev_axis[2][2];
extern int in_adev_is_nublike[2];
extern int in_enable_vibration;
@@ -112,3 +125,5 @@ extern void (*pl_plat_hud_print)(int x, int y, const char *str, int bpp);
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
#endif /* __PLUGIN_LIB_H__ */
+6 -1
View File
@@ -1,2 +1,7 @@
#ifndef __CONFIG_H__
#define __CONFIG_H__
#define MAXPATHLEN 256
#define PACKAGE_VERSION "1.9"
#define PCSX_VERSION "1.9"
#endif /* __CONFIG_H__ */
+4
View File
@@ -1,3 +1,5 @@
#ifndef __PCNT_H__
#define __PCNT_H__
enum pcounters {
PCNT_ALL,
@@ -130,3 +132,5 @@ void pcnt_gte_end(int op);
#define pcnt_print(fps)
#endif
#endif /* __PCNT_H__ */
+15 -2
View File
@@ -157,6 +157,8 @@ typedef struct
// No controller
#define PSE_PAD_TYPE_NONE 0
// MOUSE SCPH-1030
#define PSE_PAD_TYPE_MOUSE 1
// NEGCON - 16 button analog controller SLPH-00001
@@ -195,9 +197,15 @@ typedef struct
typedef struct
{
// controler type - fill it withe predefined values above
// controller type - fill it withe predefined values above
unsigned char controllerType;
//0 : no multitap between psx and pad
//1 : multitap between psx and pad on port 1
//2 : multitap between psx and pad on port 2
int portMultitap;
int requestPadIndex;
// status of buttons - every controller fills this field
unsigned short buttonStatus;
@@ -211,8 +219,13 @@ typedef struct
unsigned char Vib[2];
unsigned char VibF[2];
//configuration mode Request 0x43
int configMode;
unsigned char reserved[87];
//Lightgun values
int absoluteX,absoluteY;
} PadDataS;
+204 -79
View File
@@ -4,96 +4,221 @@ $(shell cd "$(LOCAL_PATH)" && ((git describe --always || echo) | sed -e 's/.*/#d
$(shell cd "$(LOCAL_PATH)" && (diff -q ../frontend/revision.h_ ../frontend/revision.h > /dev/null 2>&1 || cp ../frontend/revision.h_ ../frontend/revision.h))
$(shell cd "$(LOCAL_PATH)" && (rm ../frontend/revision.h_))
include $(CLEAR_VARS)
HAVE_CHD ?= 1
USE_LIBRETRO_VFS ?= 0
APP_DIR := ../../src
ROOT_DIR := $(LOCAL_PATH)/..
CORE_DIR := $(ROOT_DIR)/libpcsxcore
SPU_DIR := $(ROOT_DIR)/plugins/dfsound
GPU_DIR := $(ROOT_DIR)/plugins/gpulib
CDR_DIR := $(ROOT_DIR)/plugins/cdrcimg
INPUT_DIR := $(ROOT_DIR)/plugins/dfinput
FRONTEND_DIR := $(ROOT_DIR)/frontend
NEON_DIR := $(ROOT_DIR)/plugins/gpu_neon
UNAI_DIR := $(ROOT_DIR)/plugins/gpu_unai
PEOPS_DIR := $(ROOT_DIR)/plugins/dfxvideo
DYNAREC_DIR := $(ROOT_DIR)/libpcsxcore/new_dynarec
DEPS_DIR := $(ROOT_DIR)/deps
LIBRETRO_COMMON := $(ROOT_DIR)/libretro-common
EXTRA_INCLUDES :=
ifneq ($(TARGET_ARCH_ABI),armeabi-v7a)
NO_NEON_BUILD := 1
else
NO_NEON_BUILD := $(NO_NEON)
endif
ifeq ($(NO_NEON_BUILD)$(TARGET_ARCH_ABI),1armeabi-v7a)
LOCAL_MODULE := retro-noneon
else
LOCAL_MODULE := retro
endif
ifeq ($(TARGET_ARCH),arm)
LOCAL_ARM_MODE := arm
LOCAL_CFLAGS += -DANDROID_ARM
LOCAL_SRC_FILES += ../libpcsxcore/gte_arm.S
# dynarec
LOCAL_SRC_FILES += ../libpcsxcore/new_dynarec/new_dynarec.c ../libpcsxcore/new_dynarec/linkage_arm.S ../libpcsxcore/new_dynarec/emu_if.c ../libpcsxcore/new_dynarec/pcsxmem.c
# spu
LOCAL_SRC_FILES += ../plugins/dfsound/arm_utils.S
# misc
ifeq ($(NO_NEON_BUILD),1)
# gpu
LOCAL_CFLAGS += -DREARMED
LOCAL_SRC_FILES += ../plugins/gpu_unai/gpulib_if.cpp ../plugins/gpu_unai/gpu_arm.s
LOCAL_SRC_FILES += ../frontend/cspace_arm.S
else
LOCAL_ARM_NEON := true
LOCAL_CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
LOCAL_SRC_FILES += ../libpcsxcore/gte_neon.S ../frontend/cspace_neon.S
# gpu
LOCAL_SRC_FILES += ../plugins/gpu_neon/psx_gpu_if.c ../plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S
endif
endif
ifeq ($(TARGET_ARCH),x86)
LOCAL_CFLAGS += -DANDROID_X86
endif
ifeq ($(TARGET_ARCH),mips)
LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__
endif
ifneq ($(TARGET_ARCH),arm)
# gpu
LOCAL_CFLAGS += -DREARMED
LOCAL_SRC_FILES += ../plugins/gpu_unai/gpulib_if.cpp
endif
LOCAL_SRC_FILES += ../libpcsxcore/cdriso.c ../libpcsxcore/cdrom.c ../libpcsxcore/cheat.c ../libpcsxcore/debug.c \
../libpcsxcore/decode_xa.c ../libpcsxcore/disr3000a.c ../libpcsxcore/mdec.c \
../libpcsxcore/misc.c ../libpcsxcore/plugins.c ../libpcsxcore/ppf.c ../libpcsxcore/psxbios.c \
../libpcsxcore/psxcommon.c ../libpcsxcore/psxcounters.c ../libpcsxcore/psxdma.c ../libpcsxcore/psxhle.c \
../libpcsxcore/psxhw.c ../libpcsxcore/psxinterpreter.c ../libpcsxcore/psxmem.c ../libpcsxcore/r3000a.c \
../libpcsxcore/sio.c ../libpcsxcore/socket.c ../libpcsxcore/spu.c
LOCAL_SRC_FILES += ../libpcsxcore/gte.c ../libpcsxcore/gte_nf.c ../libpcsxcore/gte_divider.c
# core
SOURCES_C := $(CORE_DIR)/cdriso.c \
$(CORE_DIR)/cdrom.c \
$(CORE_DIR)/cheat.c \
$(CORE_DIR)/database.c \
$(CORE_DIR)/decode_xa.c \
$(CORE_DIR)/mdec.c \
$(CORE_DIR)/misc.c \
$(CORE_DIR)/plugins.c \
$(CORE_DIR)/ppf.c \
$(CORE_DIR)/psxbios.c \
$(CORE_DIR)/psxcommon.c \
$(CORE_DIR)/psxcounters.c \
$(CORE_DIR)/psxdma.c \
$(CORE_DIR)/psxhle.c \
$(CORE_DIR)/psxhw.c \
$(CORE_DIR)/psxinterpreter.c \
$(CORE_DIR)/psxmem.c \
$(CORE_DIR)/r3000a.c \
$(CORE_DIR)/sio.c \
$(CORE_DIR)/spu.c \
$(CORE_DIR)/gte.c \
$(CORE_DIR)/gte_nf.c \
$(CORE_DIR)/gte_divider.c
# spu
LOCAL_SRC_FILES += ../plugins/dfsound/dma.c ../plugins/dfsound/freeze.c \
../plugins/dfsound/registers.c ../plugins/dfsound/spu.c \
../plugins/dfsound/out.c ../plugins/dfsound/nullsnd.c
SOURCES_C += $(SPU_DIR)/dma.c \
$(SPU_DIR)/freeze.c \
$(SPU_DIR)/registers.c \
$(SPU_DIR)/spu.c \
$(SPU_DIR)/out.c \
$(SPU_DIR)/nullsnd.c
# builtin gpu
LOCAL_SRC_FILES += ../plugins/gpulib/gpu.c ../plugins/gpulib/vout_pl.c
# gpu
SOURCES_C += $(GPU_DIR)/gpu.c \
$(GPU_DIR)/vout_pl.c
# cdrcimg
LOCAL_SRC_FILES += ../plugins/cdrcimg/cdrcimg.c
SOURCES_C += $(CDR_DIR)/cdrcimg.c
# dfinput
LOCAL_SRC_FILES += ../plugins/dfinput/main.c ../plugins/dfinput/pad.c ../plugins/dfinput/guncon.c
SOURCES_C += $(INPUT_DIR)/main.c \
$(INPUT_DIR)/pad.c \
$(INPUT_DIR)/guncon.c
# misc
LOCAL_SRC_FILES += ../frontend/main.c ../frontend/plugin.c ../frontend/cspace.c
# frontend
SOURCES_C += $(FRONTEND_DIR)/main.c \
$(FRONTEND_DIR)/plugin.c \
$(FRONTEND_DIR)/cspace.c \
$(FRONTEND_DIR)/libretro.c
# libretro
LOCAL_SRC_FILES += ../frontend/libretro.c
# libchdr
SOURCES_C += \
$(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Alloc.c \
$(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Bra86.c \
$(DEPS_DIR)/libchdr/deps/lzma-19.00/src/BraIA64.c \
$(DEPS_DIR)/libchdr/deps/lzma-19.00/src/CpuArch.c \
$(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Delta.c \
$(DEPS_DIR)/libchdr/deps/lzma-19.00/src/LzFind.c \
$(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Lzma86Dec.c \
$(DEPS_DIR)/libchdr/deps/lzma-19.00/src/LzmaDec.c \
$(DEPS_DIR)/libchdr/deps/lzma-19.00/src/LzmaEnc.c \
$(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Sort.c \
$(DEPS_DIR)/libchdr/src/libchdr_bitstream.c \
$(DEPS_DIR)/libchdr/src/libchdr_cdrom.c \
$(DEPS_DIR)/libchdr/src/libchdr_chd.c \
$(DEPS_DIR)/libchdr/src/libchdr_flac.c \
$(DEPS_DIR)/libchdr/src/libchdr_huffman.c
SOURCES_ASM :=
LOCAL_CFLAGS += -O3 -ffast-math -funroll-loops -DNDEBUG -D_FILE_OFFSET_BITS=64 -DHAVE_LIBRETRO -DNO_FRONTEND -DFRONTEND_SUPPORTS_RGB565
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../include
LOCAL_LDLIBS := -lz -llog
COREFLAGS := -ffast-math -funroll-loops -DHAVE_LIBRETRO -DNO_FRONTEND -DFRONTEND_SUPPORTS_RGB565 -DANDROID -DREARMED
COREFLAGS += -DHAVE_CHD -D_7ZIP_ST
ifeq ($(USE_LIBRETRO_VFS),1)
SOURCES_C += \
$(LIBRETRO_COMMON)/compat/compat_posix_string.c \
$(LIBRETRO_COMMON)/compat/fopen_utf8.c \
$(LIBRETRO_COMMON)/encodings/compat_strl.c \
$(LIBRETRO_COMMON)/encodings/encoding_utf.c \
$(LIBRETRO_COMMON)/file/file_path.c \
$(LIBRETRO_COMMON)/streams/file_stream.c \
$(LIBRETRO_COMMON)/streams/file_stream_transforms.c \
$(LIBRETRO_COMMON)/string/stdstring.c \
$(LIBRETRO_COMMON)/time/rtime.c \
$(LIBRETRO_COMMON)/vfs/vfs_implementation.c
COREFLAGS += -DUSE_LIBRETRO_VFS
endif
HAVE_ARI64=0
HAVE_LIGHTREC=0
LIGHTREC_CUSTOM_MAP=0
HAVE_GPU_NEON=0
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
HAVE_ARI64=1
HAVE_GPU_NEON=1
else ifeq ($(TARGET_ARCH_ABI),armeabi)
HAVE_ARI64=1
else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
HAVE_ARI64=1
HAVE_GPU_NEON=1
else ifeq ($(TARGET_ARCH_ABI),x86_64)
HAVE_LIGHTREC=1
HAVE_GPU_NEON=1
else ifeq ($(TARGET_ARCH_ABI),x86)
HAVE_LIGHTREC=1
HAVE_GPU_NEON=1
else
COREFLAGS += -DDRC_DISABLE
endif
COREFLAGS += -DLIGHTREC_CUSTOM_MAP=$(LIGHTREC_CUSTOM_MAP)
ifeq ($(HAVE_ARI64),1)
SOURCES_C += $(DYNAREC_DIR)/new_dynarec.c \
$(DYNAREC_DIR)/pcsxmem.c
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
SOURCES_ASM += $(DYNAREC_DIR)/linkage_arm64.S
else
SOURCES_ASM += $(CORE_DIR)/gte_arm.S \
$(SPU_DIR)/arm_utils.S \
$(DYNAREC_DIR)/linkage_arm.S
endif
endif
SOURCES_C += $(DYNAREC_DIR)/emu_if.c
ifeq ($(HAVE_LIGHTREC),1)
COREFLAGS += -DLIGHTREC -DLIGHTREC_STATIC
EXTRA_INCLUDES += $(DEPS_DIR)/lightning/include \
$(DEPS_DIR)/lightrec \
$(DEPS_DIR)/lightrec/tlsf \
$(ROOT_DIR)/include/lightning \
$(ROOT_DIR)/include/lightrec
SOURCES_C += $(DEPS_DIR)/lightrec/blockcache.c \
$(DEPS_DIR)/lightrec/disassembler.c \
$(DEPS_DIR)/lightrec/emitter.c \
$(DEPS_DIR)/lightrec/interpreter.c \
$(DEPS_DIR)/lightrec/lightrec.c \
$(DEPS_DIR)/lightrec/memmanager.c \
$(DEPS_DIR)/lightrec/optimizer.c \
$(DEPS_DIR)/lightrec/regcache.c \
$(DEPS_DIR)/lightrec/recompiler.c \
$(DEPS_DIR)/lightrec/reaper.c
SOURCES_C += $(DEPS_DIR)/lightning/lib/jit_disasm.c \
$(DEPS_DIR)/lightning/lib/jit_memory.c \
$(DEPS_DIR)/lightning/lib/jit_names.c \
$(DEPS_DIR)/lightning/lib/jit_note.c \
$(DEPS_DIR)/lightning/lib/jit_print.c \
$(DEPS_DIR)/lightning/lib/jit_size.c \
$(DEPS_DIR)/lightning/lib/lightning.c
SOURCES_C += $(CORE_DIR)/lightrec/plugin.c $(DEPS_DIR)/lightrec/tlsf/tlsf.c
ifeq ($(LIGHTREC_CUSTOM_MAP),1)
SOURCES_C += $(CORE_DIR)/lightrec/mem.c
endif
endif
ifeq ($(HAVE_GPU_NEON),1)
COREFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP -DGPU_NEON
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
COREFLAGS += -DHAVE_bgr555_to_rgb565 -DHAVE_bgr888_to_x
SOURCES_ASM += $(CORE_DIR)/gte_neon.S \
$(NEON_DIR)/psx_gpu/psx_gpu_arm_neon.S \
$(FRONTEND_DIR)/cspace_neon.S
else
COREFLAGS += -DSIMD_BUILD
SOURCES_C += $(NEON_DIR)/psx_gpu/psx_gpu_simd.c
endif
SOURCES_C += $(NEON_DIR)/psx_gpu_if.c
else ifeq ($(TARGET_ARCH_ABI),armeabi)
COREFLAGS += -DUSE_GPULIB=1 -DGPU_UNAI
COREFLAGS += -DHAVE_bgr555_to_rgb565
SOURCES_ASM += $(UNAI_DIR)/gpu_arm.S \
$(FRONTEND_DIR)/cspace_arm.S
SOURCES_C += $(UNAI_DIR)/gpulib_if.cpp
else
COREFLAGS += -fno-strict-aliasing -DGPU_PEOPS
SOURCES_C += $(PEOPS_DIR)/gpulib_if.c
endif
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
ifneq ($(GIT_VERSION)," unknown")
COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
include $(CLEAR_VARS)
LOCAL_MODULE := retro
LOCAL_SRC_FILES := $(SOURCES_C) $(SOURCES_ASM)
LOCAL_CFLAGS := $(COREFLAGS)
LOCAL_C_INCLUDES := $(ROOT_DIR)/include
LOCAL_C_INCLUDES += $(DEPS_DIR)/crypto $(DEPS_DIR)/libchdr/deps/lzma-19.00/include $(DEPS_DIR)/libchdr/include $(DEPS_DIR)/libchdr/include/libchdr
LOCAL_C_INCLUDES += $(LIBRETRO_COMMON)/include
LOCAL_C_INCLUDES += $(EXTRA_INCLUDES)
LOCAL_LDFLAGS := -Wl,-version-script=$(FRONTEND_DIR)/link.T
LOCAL_LDLIBS := -lz -llog
LOCAL_ARM_MODE := arm
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_ARM_NEON := true
endif
include $(BUILD_SHARED_LIBRARY)
+1 -1
View File
@@ -1 +1 @@
APP_ABI := armeabi armeabi-v7a
APP_ABI := all
+1 -1
View File
@@ -1518,7 +1518,7 @@ void psxDma3(u32 madr, u32 bcr, u32 chcr) {
switch (chcr & 0x71000000) {
case 0x11000000:
ptr = (u8 *)PSXM(madr);
if (ptr == NULL) {
if (ptr == INVALID_PTR) {
CDR_LOG_I("psxDma3() Log: *** DMA 3 *** NULL Pointer!\n");
break;
}
+1 -1
View File
@@ -30,7 +30,7 @@ cycle_multiplier_overrides[] =
* changing memcard settings is enough to break/unbreak it */
{ "SLPS02528", 190 },
{ "SLPS02636", 190 },
#ifdef DRC_DISABLE /* new_dynarec has a hack for this game */
#if defined(DRC_DISABLE) || defined(LIGHTREC) /* new_dynarec has a hack for this game */
/* Parasite Eve II - internal timer checks */
{ "SLUS01042", 125 },
{ "SLUS01055", 125 },
+1 -1
View File
@@ -450,7 +450,7 @@ static void ProcessCommands() {
sprintf(reply, "200 %s\r\n", arguments == NULL ? "OK" : arguments);
break;
case 0x101:
sprintf(reply, "201 %s\r\n", PACKAGE_VERSION);
sprintf(reply, "201 %s\r\n", PCSX_VERSION);
break;
case 0x102:
sprintf(reply, "202 1.0\r\n");
+11 -11
View File
@@ -78,17 +78,17 @@ typedef char* (*TdisR3000AF)(u32 code, u32 pc);
#define _Branch_ (pc + 4 + ((short)_Im_ * 4))
#define _OfB_ _Im_, _nRs_
#define dName(i) sprintf(ostr, "%s %-7s,", ostr, i)
#define dGPR(i) sprintf(ostr, "%s %8.8x (%s),", ostr, psxRegs.GPR.r[i], disRNameGPR[i])
#define dCP0(i) sprintf(ostr, "%s %8.8x (%s),", ostr, psxRegs.CP0.r[i], disRNameCP0[i])
#define dHI() sprintf(ostr, "%s %8.8x (%s),", ostr, psxRegs.GPR.n.hi, "hi")
#define dLO() sprintf(ostr, "%s %8.8x (%s),", ostr, psxRegs.GPR.n.lo, "lo")
#define dImm() sprintf(ostr, "%s %4.4x (%d),", ostr, _Im_, _Im_)
#define dTarget() sprintf(ostr, "%s %8.8x,", ostr, _Target_)
#define dSa() sprintf(ostr, "%s %2.2x (%d),", ostr, _Sa_, _Sa_)
#define dOfB() sprintf(ostr, "%s %4.4x (%8.8x (%s)),", ostr, _Im_, psxRegs.GPR.r[_Rs_], disRNameGPR[_Rs_])
#define dOffset() sprintf(ostr, "%s %8.8x,", ostr, _Branch_)
#define dCode() sprintf(ostr, "%s %8.8x,", ostr, (code >> 6) & 0xffffff)
#define dName(i) snprintf(ostr, sizeof(ostr), "%s %-7s,", ostr, i)
#define dGPR(i) snprintf(ostr, sizeof(ostr), "%s %8.8x (%s),", ostr, psxRegs.GPR.r[i], disRNameGPR[i])
#define dCP0(i) snprintf(ostr, sizeof(ostr), "%s %8.8x (%s),", ostr, psxRegs.CP0.r[i], disRNameCP0[i])
#define dHI() snprintf(ostr, sizeof(ostr), "%s %8.8x (%s),", ostr, psxRegs.GPR.n.hi, "hi")
#define dLO() snprintf(ostr, sizeof(ostr), "%s %8.8x (%s),", ostr, psxRegs.GPR.n.lo, "lo")
#define dImm() snprintf(ostr, sizeof(ostr), "%s %4.4x (%d),", ostr, _Im_, _Im_)
#define dTarget() snprintf(ostr, sizeof(ostr), "%s %8.8x,", ostr, _Target_)
#define dSa() snprintf(ostr, sizeof(ostr), "%s %2.2x (%d),", ostr, _Sa_, _Sa_)
#define dOfB() snprintf(ostr, sizeof(ostr), "%s %4.4x (%8.8x (%s)),", ostr, _Im_, psxRegs.GPR.r[_Rs_], disRNameGPR[_Rs_])
#define dOffset() snprintf(ostr, sizeof(ostr), "%s %8.8x,", ostr, _Branch_)
#define dCode() snprintf(ostr, sizeof(ostr), "%s %8.8x,", ostr, (code >> 6) & 0xffffff)
/*********************************************************
* Arithmetic with immediate operand *
+5
View File
@@ -21,6 +21,9 @@
* that GPU plugin doesn't.
*/
#ifndef __GPU_H__
#define __GPU_H__
#define PSXGPU_LCF (1<<31)
#define PSXGPU_nBUSY (1<<26)
#define PSXGPU_ILACE (1<<22)
@@ -38,3 +41,5 @@
HW_GPU_STATUS &= SWAP32(PSXGPU_TIMING_BITS); \
HW_GPU_STATUS |= SWAP32(GPU_readStatus() & ~PSXGPU_TIMING_BITS); \
}
#endif /* __GPU_H__ */
+5
View File
@@ -15,6 +15,9 @@
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
#ifndef __GTE_ARM_H__
#define __GTE_ARM_H__
void gteRTPS_nf_arm(void *cp2_regs, int opcode);
void gteRTPT_nf_arm(void *cp2_regs, int opcode);
void gteNCLIP_arm(void *cp2_regs, int opcode);
@@ -28,3 +31,5 @@ void gteMACtoIR_lm0(void *cp2_regs);
void gteMACtoIR_lm1(void *cp2_regs);
void gteMACtoIR_lm0_nf(void *cp2_regs);
void gteMACtoIR_lm1_nf(void *cp2_regs);
#endif /* __GTE_ARM_H__ */
+5
View File
@@ -15,4 +15,9 @@
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
#ifndef __GTE_DIVIDER_H__
#define __GTE_DIVIDER_H__
u32 DIVIDE(u16 n, u16 d);
#endif /* __GTE_DIVIDER_H__ */
+5
View File
@@ -15,6 +15,9 @@
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
#ifndef __GTE_NEON_H__
#define __GTE_NEON_H__
void gteRTPS_neon(void *cp2_regs, int opcode);
void gteRTPT_neon(void *cp2_regs, int opcode);
@@ -23,3 +26,5 @@ void gteMVMVA_part_neon(void *cp2_regs, int opcode);
// after NEON call only, does not do gteIR
void gteMACtoIR_flags_neon(void *cp2_regs, int lm);
#endif /* __GTE_NEON_H__ */
+28
View File
@@ -0,0 +1,28 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2022 Paul Cercueil <[email protected]>
*/
#ifndef __LIGHTREC_MEM_H__
#define __LIGHTREC_MEM_H__
#ifdef LIGHTREC
#define CODE_BUFFER_SIZE (8 * 1024 * 1024)
extern void *code_buffer;
int lightrec_init_mmap(void);
void lightrec_free_mmap(void);
#else /* if !LIGHTREC */
#define lightrec_init_mmap() -1 /* should not be called */
#define lightrec_free_mmap()
#undef LIGHTREC_CUSTOM_MAP
#define LIGHTREC_CUSTOM_MAP 0
#endif
#endif /* __LIGHTREC_MEM_H__ */
+52 -23
View File
@@ -69,7 +69,7 @@ static void mmssdd( char *b, char *p )
m = ((m / 10) << 4) | m % 10;
s = ((s / 10) << 4) | s % 10;
d = ((d / 10) << 4) | d % 10;
d = ((d / 10) << 4) | d % 10;
p[0] = m;
p[1] = s;
@@ -176,7 +176,7 @@ int LoadCdrom() {
// is just below, do it here
fake_bios_gpu_setup();
if (!Config.HLE) {
if (!Config.HLE && !Config.SlowBoot) {
// skip BIOS logos
psxRegs.pc = psxRegs.GPR.n.ra;
return 0;
@@ -187,7 +187,7 @@ int LoadCdrom() {
READTRACK();
// skip head and sub, and go to the root directory record
dir = (struct iso_directory_record*) &buf[12+156];
dir = (struct iso_directory_record*) &buf[12+156];
mmssdd(dir->extent, (char*)time);
@@ -232,7 +232,7 @@ int LoadCdrom() {
psxRegs.pc = SWAP32(tmpHead.pc0);
psxRegs.GPR.n.gp = SWAP32(tmpHead.gp0);
psxRegs.GPR.n.sp = SWAP32(tmpHead.s_addr);
psxRegs.GPR.n.sp = SWAP32(tmpHead.s_addr);
if (psxRegs.GPR.n.sp == 0) psxRegs.GPR.n.sp = 0x801fff00;
tmpHead.t_size = SWAP32(tmpHead.t_size);
@@ -248,7 +248,7 @@ int LoadCdrom() {
incTime();
READTRACK();
if (ptr != NULL) memcpy(ptr, buf+12, 2048);
if (ptr != INVALID_PTR) memcpy(ptr, buf+12, 2048);
tmpHead.t_size -= 2048;
tmpHead.t_addr += 2048;
@@ -272,7 +272,7 @@ int LoadCdromFile(const char *filename, EXE_HEADER *head) {
READTRACK();
// skip head and sub, and go to the root directory record
dir = (struct iso_directory_record *)&buf[12 + 156];
dir = (struct iso_directory_record *)&buf[12 + 156];
mmssdd(dir->extent, (char*)time);
@@ -294,7 +294,7 @@ int LoadCdromFile(const char *filename, EXE_HEADER *head) {
READTRACK();
mem = PSXM(addr);
if (mem)
if (mem != INVALID_PTR)
memcpy(mem, buf + 12, 2048);
size -= 2048;
@@ -327,7 +327,7 @@ int CheckCdrom() {
strncpy(CdromLabel, buf + 52, 32);
// skip head and sub, and go to the root directory record
dir = (struct iso_directory_record *)&buf[12 + 156];
dir = (struct iso_directory_record *)&buf[12 + 156];
mmssdd(dir->extent, (char *)time);
@@ -355,6 +355,14 @@ int CheckCdrom() {
return -1;
}
}
/* Workaround for Wild Arms EU/US which has non-standard string causing incorrect region detection */
if (exename[0] == 'E' && exename[1] == 'X' && exename[2] == 'E' && exename[3] == '\\') {
size_t offset = 4;
size_t i, len = strlen(exename) - offset;
for (i = 0; i < len; i++)
exename[i] = exename[i + offset];
exename[i] = '\0';
}
} else if (GetCdromFile(mdir, time, "PSX.EXE;1") != -1) {
strcpy(exename, "PSX.EXE;1");
strcpy(CdromId, "SLUS99999");
@@ -409,7 +417,9 @@ static int PSXGetFileType(FILE *f) {
current = ftell(f);
fseek(f, 0L, SEEK_SET);
fread(mybuf, 2048, 1, f);
if (fread(&mybuf, 1, sizeof(mybuf), f) != sizeof(mybuf))
goto io_fail;
fseek(f, current, SEEK_SET);
exe_hdr = (EXE_HEADER *)mybuf;
@@ -424,6 +434,12 @@ static int PSXGetFileType(FILE *f) {
return COFF_EXE;
return INVALID_EXE;
io_fail:
#ifndef NDEBUG
SysPrintf(_("File IO error in <%s:%s>.\n"), __FILE__, __func__);
#endif
return INVALID_EXE;
}
// temporary pandora workaround..
@@ -432,7 +448,7 @@ size_t fread_to_ram(void *ptr, size_t size, size_t nmemb, FILE *stream)
{
void *tmp;
size_t ret = 0;
tmp = malloc(size * nmemb);
if (tmp) {
ret = fread(tmp, size, nmemb, stream);
@@ -451,8 +467,8 @@ int Load(const char *ExePath) {
u32 section_address, section_size;
void *mem;
strncpy(CdromId, "SLUS99999", 9);
strncpy(CdromLabel, "SLUS_999.99", 11);
strcpy(CdromId, "SLUS99999");
strcpy(CdromLabel, "SLUS_999.99");
tmpFile = fopen(ExePath, "rb");
if (tmpFile == NULL) {
@@ -462,19 +478,19 @@ int Load(const char *ExePath) {
type = PSXGetFileType(tmpFile);
switch (type) {
case PSX_EXE:
fread(&tmpHead,sizeof(EXE_HEADER),1,tmpFile);
if (fread(&tmpHead, 1, sizeof(EXE_HEADER), tmpFile) != sizeof(EXE_HEADER))
goto fail_io;
section_address = SWAP32(tmpHead.t_addr);
section_size = SWAP32(tmpHead.t_size);
mem = PSXM(section_address);
if (mem != NULL) {
fseek(tmpFile, 0x800, SEEK_SET);
if (mem != INVALID_PTR) {
fseek(tmpFile, 0x800, SEEK_SET);
fread_to_ram(mem, section_size, 1, tmpFile);
psxCpu->Clear(section_address, section_size / 4);
}
fclose(tmpFile);
psxRegs.pc = SWAP32(tmpHead.pc0);
psxRegs.GPR.n.gp = SWAP32(tmpHead.gp0);
psxRegs.GPR.n.sp = SWAP32(tmpHead.s_addr);
psxRegs.GPR.n.sp = SWAP32(tmpHead.s_addr);
if (psxRegs.GPR.n.sp == 0)
psxRegs.GPR.n.sp = 0x801fff00;
retval = 0;
@@ -482,25 +498,29 @@ int Load(const char *ExePath) {
case CPE_EXE:
fseek(tmpFile, 6, SEEK_SET); /* Something tells me we should go to 4 and read the "08 00" here... */
do {
fread(&opcode, 1, 1, tmpFile);
if (fread(&opcode, 1, sizeof(opcode), tmpFile) != sizeof(opcode))
goto fail_io;
switch (opcode) {
case 1: /* Section loading */
fread(&section_address, 4, 1, tmpFile);
fread(&section_size, 4, 1, tmpFile);
if (fread(&section_address, 1, sizeof(section_address), tmpFile) != sizeof(section_address))
goto fail_io;
if (fread(&section_size, 1, sizeof(section_size), tmpFile) != sizeof(section_size))
goto fail_io;
section_address = SWAPu32(section_address);
section_size = SWAPu32(section_size);
#ifdef EMU_LOG
EMU_LOG("Loading %08X bytes from %08X to %08X\n", section_size, ftell(tmpFile), section_address);
#endif
mem = PSXM(section_address);
if (mem != NULL) {
if (mem != INVALID_PTR) {
fread_to_ram(mem, section_size, 1, tmpFile);
psxCpu->Clear(section_address, section_size / 4);
}
break;
case 3: /* register loading (PC only?) */
fseek(tmpFile, 2, SEEK_CUR); /* unknown field */
fread(&psxRegs.pc, 4, 1, tmpFile);
if (fread(&psxRegs.pc, 1, sizeof(psxRegs.pc), tmpFile) != sizeof(psxRegs.pc))
goto fail_io;
psxRegs.pc = SWAPu32(psxRegs.pc);
break;
case 0: /* End of file */
@@ -529,7 +549,16 @@ int Load(const char *ExePath) {
CdromLabel[0] = '\0';
}
if (tmpFile)
fclose(tmpFile);
return retval;
fail_io:
#ifndef NDEBUG
SysPrintf(_("File IO error in <%s:%s>.\n"), __FILE__, __func__);
#endif
fclose(tmpFile);
return -1;
}
// STATES
@@ -563,7 +592,7 @@ struct PcsxSaveFuncs SaveFuncs = {
zlib_open, zlib_read, zlib_write, zlib_seek, zlib_close
};
static const char PcsxHeader[32] = "STv4 PCSX v" PACKAGE_VERSION;
static const char PcsxHeader[32] = "STv4 PCSX v" PCSX_VERSION;
// Savestate Versioning!
// If you make changes to the savestate version, please increment the value below.
+1 -1
View File
@@ -190,7 +190,7 @@ void new_dyna_freeze(void *f, int mode)
//printf("drc: %d block info entries %s\n", size/8, mode ? "saved" : "loaded");
}
#ifndef DRC_DISABLE
#if !defined(DRC_DISABLE) && !defined(LIGHTREC)
/* GTE stuff */
void *gte_handlers[64];
+3 -3
View File
@@ -702,7 +702,7 @@ void CALLBACK clearDynarec(void) {
int LoadPlugins() {
int ret;
char Plugin[MAXPATHLEN];
char Plugin[MAXPATHLEN * 2];
ReleasePlugins();
SysLibError();
@@ -807,7 +807,7 @@ int ReloadCdromPlugin()
if (UsingIso()) {
LoadCDRplugin(NULL);
} else {
char Plugin[MAXPATHLEN];
char Plugin[MAXPATHLEN * 2];
sprintf(Plugin, "%s/%s", Config.PluginsDir, Config.Cdr);
if (LoadCDRplugin(Plugin) == -1) return -1;
}
@@ -820,7 +820,7 @@ void SetIsoFile(const char *filename) {
IsoFile[0] = '\0';
return;
}
strncpy(IsoFile, filename, MAXPATHLEN);
strncpy(IsoFile, filename, MAXPATHLEN - 1);
}
const char *GetIsoFile(void) {
+40 -13
View File
@@ -183,7 +183,7 @@ void BuildPPFCache() {
char method, undo = 0, blockcheck = 0;
int dizlen, dizyn;
unsigned char ppfmem[512];
char szPPF[MAXPATHLEN];
char szPPF[MAXPATHLEN * 2];
int count, seekpos, pos;
u32 anz; // use 32-bit to avoid stupid overflows
s32 ladr, off, anx;
@@ -212,7 +212,8 @@ void BuildPPFCache() {
if (ppffile == NULL) return;
memset(buffer, 0, 5);
fread(buffer, 3, 1, ppffile);
if (fread(buffer, 1, 3, ppffile) != 3)
goto fail_io;
if (strcmp(buffer, "PPF") != 0) {
SysPrintf(_("Invalid PPF patch: %s.\n"), szPPF);
@@ -235,12 +236,14 @@ void BuildPPFCache() {
fseek(ppffile, -8, SEEK_END);
memset(buffer, 0, 5);
fread(buffer, 4, 1, ppffile);
if (fread(buffer, 1, 4, ppffile) != 4)
goto fail_io;
if (strcmp(".DIZ", buffer) != 0) {
dizyn = 0;
} else {
fread(&dizlen, 4, 1, ppffile);
if (fread(&dizlen, 1, 4, ppffile) != 4)
goto fail_io;
dizlen = SWAP32(dizlen);
dizyn = 1;
}
@@ -266,12 +269,15 @@ void BuildPPFCache() {
fseek(ppffile, -6, SEEK_END);
memset(buffer, 0, 5);
fread(buffer, 4, 1, ppffile);
if (fread(buffer, 1, 4, ppffile) != 4)
goto fail_io;
dizlen = 0;
if (strcmp(".DIZ", buffer) == 0) {
fseek(ppffile, -2, SEEK_END);
fread(&dizlen, 2, 1, ppffile);
// TODO: Endian/size unsafe?
if (fread(&dizlen, 1, 2, ppffile) != 2)
goto fail_io;
dizlen = SWAP32(dizlen);
dizlen += 36;
}
@@ -298,13 +304,19 @@ void BuildPPFCache() {
// now do the data reading
do {
fseek(ppffile, seekpos, SEEK_SET);
fread(&pos, 4, 1, ppffile);
if (fread(&pos, 1, sizeof(pos), ppffile) != sizeof(pos))
goto fail_io;
pos = SWAP32(pos);
if (method == 2) fread(buffer, 4, 1, ppffile); // skip 4 bytes on ppf3 (no int64 support here)
if (method == 2) {
// skip 4 bytes on ppf3 (no int64 support here)
if (fread(buffer, 1, 4, ppffile) != 4)
goto fail_io;
}
anz = fgetc(ppffile);
fread(ppfmem, anz, 1, ppffile);
if (fread(ppfmem, 1, anz, ppffile) != anz)
goto fail_io;
ladr = pos / CD_FRAMESIZE_RAW;
off = pos % CD_FRAMESIZE_RAW;
@@ -331,6 +343,12 @@ void BuildPPFCache() {
FillPPFCache(); // build address array
SysPrintf(_("Loaded PPF %d.0 patch: %s.\n"), method + 1, szPPF);
fail_io:
#ifndef NDEBUG
SysPrintf(_("File IO error in <%s:%s>.\n"), __FILE__, __func__);
#endif
fclose(ppffile);
}
// redump.org SBI files, slightly different handling from PCSX-Reloaded
@@ -353,12 +371,15 @@ int LoadSBI(const char *fname, int sector_count) {
}
// 4-byte SBI header
fread(buffer, 1, 4, sbihandle);
if (fread(buffer, 1, 4, sbihandle) != 4)
goto fail_io;
while (1) {
s = fread(sbitime, 1, 3, sbihandle);
if (s != 3)
break;
fread(&t, 1, 1, sbihandle);
goto fail_io;
if (fread(&t, 1, sizeof(t), sbihandle) != sizeof(t))
goto fail_io;
switch (t) {
default:
case 1:
@@ -379,8 +400,14 @@ int LoadSBI(const char *fname, int sector_count) {
}
fclose(sbihandle);
return 0;
fail_io:
#ifndef NDEBUG
SysPrintf(_("File IO error in <%s:%s>.\n"), __FILE__, __func__);
#endif
fclose(sbihandle);
return -1;
}
void UnloadSBI(void) {
+111 -106
View File
@@ -18,7 +18,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *
***************************************************************************/
/* Gameblabla 2018-2019 :
/* Gameblabla 2018-2019 :
* Numerous changes to bios calls as well as improvements in order to conform to nocash's findings
* for the PSX bios calls. Thanks senquack for helping out with some of the changes
* and helping to spot issues and refine my patches.
@@ -33,6 +33,7 @@
#include "psxbios.h"
#include "psxhw.h"
#include "gpu.h"
#include "sio.h"
#include <zlib.h>
#if (defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__)
@@ -221,7 +222,7 @@ typedef struct {
u32 func;
} TCB;
typedef struct {
typedef struct {
u32 _pc0;
u32 gp0;
u32 t_addr;
@@ -259,7 +260,7 @@ static int pad_buf1len, pad_buf2len;
static int pad_stopped = 0;
static u32 regs[35];
static EvCB *Event;
static EvCB *EventCB;
static EvCB *HwEV; // 0xf0
static EvCB *EvEV; // 0xf1
static EvCB *RcEV; // 0xf2
@@ -271,10 +272,10 @@ static u32 *heap_addr = NULL;
static u32 *heap_end = NULL;
static u32 SysIntRP[8];
static int CardState = -1;
static TCB Thread[8];
static TCB ThreadCB[8];
static int CurThread = 0;
static FileDesc FDesc[32];
static u32 card_active_chan;
static u32 card_active_chan = 0;
boolean hleSoftCall = FALSE;
@@ -303,12 +304,12 @@ static inline void softCall2(u32 pc) {
}
static inline void DeliverEvent(u32 ev, u32 spec) {
if (Event[ev][spec].status != EvStACTIVE) return;
if (EventCB[ev][spec].status != EvStACTIVE) return;
// Event[ev][spec].status = EvStALREADY;
if (Event[ev][spec].mode == EvMdINTR) {
softCall2(Event[ev][spec].fhandler);
} else Event[ev][spec].status = EvStALREADY;
// EventCB[ev][spec].status = EvStALREADY;
if (EventCB[ev][spec].mode == EvMdINTR) {
softCall2(EventCB[ev][spec].fhandler);
} else EventCB[ev][spec].status = EvStALREADY;
}
static unsigned interrupt_r26=0x8004E8B0;
@@ -372,7 +373,7 @@ void psxBios_getc(void) // 0x03, 0x35
#endif
v0 = -1;
if (pa1) {
if (pa1 != INVALID_PTR) {
switch (a0) {
case 2: buread(pa1, 1, 1); break;
case 3: buread(pa1, 2, 1); break;
@@ -391,7 +392,7 @@ void psxBios_putc(void) // 0x09, 0x3B
PSXBIOS_LOG("psxBios_%s\n", biosA0n[0x09]);
#endif
v0 = -1;
if (!pa1) {
if (pa1 == INVALID_PTR) {
pc0 = ra;
return;
}
@@ -700,7 +701,7 @@ void psxBios_index() { // 0x1c
pc0 = ra;
return;
}
do {
if (*p == a1) {
v0 = a0 + (p - (char *)Ra0);
@@ -929,7 +930,7 @@ void psxBios_memcmp() { // 0x2d
void psxBios_memchr() { // 0x2e
char *p = (char *)Ra0;
if (a0 == 0 || a2 > 0x7FFFFFFF)
{
pc0 = ra;
@@ -1260,7 +1261,7 @@ void psxBios_printf() { // 0x3f
void *psp;
psp = PSXM(sp);
if (psp) {
if (psp != INVALID_PTR) {
memcpy(save, psp, 4 * 4);
psxMu32ref(sp) = SWAP32((u32)a0);
psxMu32ref(sp + 4) = SWAP32((u32)a1);
@@ -1429,7 +1430,7 @@ void psxBios_GPU_dw() { // 0x46
}
pc0 = ra;
}
}
void psxBios_mem2vram() { // 0x47
int size;
@@ -1457,8 +1458,8 @@ void psxBios_SendGPU() { // 0x48
void psxBios_GPU_cw() { // 0x49
gpuSyncPluginSR();
GPU_writeData(a0);
pc0 = ra;
v0 = HW_GPU_STATUS;
pc0 = ra;
}
void psxBios_GPU_cwb() { // 0x4a
@@ -1509,7 +1510,7 @@ void psxBios_LoadExec() { // 51
#endif
s_addr = a1; s_size = a2;
a1 = 0xf000;
a1 = 0xf000;
psxBios_Load();
header->S_addr = s_addr;
@@ -1564,7 +1565,7 @@ void psxBios_SetMem() { // 9f
psxHu32ref(0x1060) = SWAP32(new | 0x300);
psxMu32ref(0x060) = a0;
SysPrintf("Change effective memory : %d MBytes\n",a0);
default:
SysPrintf("Effective memory must be 2/8 MBytes\n");
break;
@@ -1584,16 +1585,16 @@ void psxBios__card_info() { // ab
#ifdef PSXBIOS_LOG
PSXBIOS_LOG("psxBios_%s: %x\n", biosA0n[0xab], a0);
#endif
u32 ret;
u32 ret, port;
card_active_chan = a0;
port = card_active_chan >> 4;
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;
switch (port) {
case 0x0:
case 0x1:
ret = 0x2;
if (McdDisable[port & 1])
ret = 0x8;
break;
default:
#ifdef PSXBIOS_LOG
@@ -1602,8 +1603,12 @@ void psxBios__card_info() { // ab
ret = 0x11;
break;
}
DeliverEvent(0x11, 0x2); // 0xf4000001, 0x0004
if (McdDisable[0] && McdDisable[1])
ret = 0x8;
DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004
// DeliverEvent(0x81, 0x2); // 0xf4000001, 0x0004
DeliverEvent(0x81, ret); // 0xf4000001, 0x0004
v0 = 1; pc0 = ra;
}
@@ -1692,14 +1697,14 @@ void psxBios_ResetRCnt() { // 06
}
/* gets ev for use with Event */
/* gets ev for use with EventCB */
#define GetEv() \
ev = (a0 >> 24) & 0xf; \
if (ev == 0xf) ev = 0x5; \
ev*= 32; \
ev+= a0&0x1f;
/* gets spec for use with Event */
/* gets spec for use with EventCB */
#define GetSpec() \
spec = 0; \
switch (a1) { \
@@ -1737,9 +1742,9 @@ void psxBios_OpenEvent() { // 08
PSXBIOS_LOG("psxBios_%s %x,%x (class:%x, spec:%x, mode:%x, func:%x)\n", biosB0n[0x08], ev, spec, a0, a1, a2, a3);
#endif
Event[ev][spec].status = EvStWAIT;
Event[ev][spec].mode = a2;
Event[ev][spec].fhandler = a3;
EventCB[ev][spec].status = EvStWAIT;
EventCB[ev][spec].mode = a2;
EventCB[ev][spec].fhandler = a3;
v0 = ev | (spec << 8);
pc0 = ra;
@@ -1755,7 +1760,7 @@ void psxBios_CloseEvent() { // 09
PSXBIOS_LOG("psxBios_%s %x,%x\n", biosB0n[0x09], ev, spec);
#endif
Event[ev][spec].status = EvStUNUSED;
EventCB[ev][spec].status = EvStUNUSED;
v0 = 1; pc0 = ra;
}
@@ -1768,17 +1773,17 @@ void psxBios_WaitEvent() { // 0a
#ifdef PSXBIOS_LOG
PSXBIOS_LOG("psxBios_%s %x,%x\n", biosB0n[0x0a], ev, spec);
#endif
if (Event[ev][spec].status == EvStUNUSED)
if (EventCB[ev][spec].status == EvStUNUSED)
{
v0 = 0;
pc0 = ra;
pc0 = ra;
return;
}
if (Event[ev][spec].status == EvStALREADY)
if (EventCB[ev][spec].status == EvStALREADY)
{
/* Callback events (mode=EvMdINTR) do never set the ready flag (and thus WaitEvent would hang forever). */
if (!(Event[ev][spec].mode == EvMdINTR)) Event[ev][spec].status = EvStACTIVE;
if (!(EventCB[ev][spec].mode == EvMdINTR)) EventCB[ev][spec].status = EvStACTIVE;
v0 = 1;
pc0 = ra;
return;
@@ -1794,12 +1799,12 @@ void psxBios_TestEvent() { // 0b
ev = a0 & 0xff;
spec = (a0 >> 8) & 0xff;
if (Event[ev][spec].status == EvStALREADY)
if (EventCB[ev][spec].status == EvStALREADY)
{
if (!(Event[ev][spec].mode == EvMdINTR)) Event[ev][spec].status = EvStACTIVE;
if (!(EventCB[ev][spec].mode == EvMdINTR)) EventCB[ev][spec].status = EvStACTIVE;
v0 = 1;
}
else
}
else
{
v0 = 0;
}
@@ -1821,7 +1826,7 @@ void psxBios_EnableEvent() { // 0c
PSXBIOS_LOG("psxBios_%s %x,%x\n", biosB0n[0x0c], ev, spec);
#endif
Event[ev][spec].status = EvStACTIVE;
EventCB[ev][spec].status = EvStACTIVE;
v0 = 1; pc0 = ra;
}
@@ -1836,7 +1841,7 @@ void psxBios_DisableEvent() { // 0d
PSXBIOS_LOG("psxBios_%s %x,%x\n", biosB0n[0x0d], ev, spec);
#endif
Event[ev][spec].status = EvStWAIT;
EventCB[ev][spec].status = EvStWAIT;
v0 = 1; pc0 = ra;
}
@@ -1850,7 +1855,7 @@ void psxBios_OpenTh() { // 0e
for (th=1; th<8; th++)
{
if (Thread[th].status == 0) break;
if (ThreadCB[th].status == 0) break;
}
if (th == 8) {
@@ -1867,10 +1872,10 @@ void psxBios_OpenTh() { // 0e
PSXBIOS_LOG("psxBios_%s: %x\n", biosB0n[0x0e], th);
#endif
Thread[th].status = 1;
Thread[th].func = a0;
Thread[th].reg[29] = a1;
Thread[th].reg[28] = a2;
ThreadCB[th].status = 1;
ThreadCB[th].func = a0;
ThreadCB[th].reg[29] = a1;
ThreadCB[th].reg[28] = a2;
v0 = th; pc0 = ra;
}
@@ -1887,8 +1892,8 @@ void psxBios_CloseTh() { // 0f
#endif
/* The return value is always 1 (even if the handle was already closed). */
v0 = 1;
if (Thread[th].status != 0) {
Thread[th].status = 0;
if (ThreadCB[th].status != 0) {
ThreadCB[th].status = 0;
}
pc0 = ra;
@@ -1906,18 +1911,18 @@ void psxBios_ChangeTh() { // 10
#endif
/* The return value is always 1. */
v0 = 1;
if (Thread[th].status == 0 || CurThread == th) {
if (ThreadCB[th].status == 0 || CurThread == th) {
pc0 = ra;
} else {
if (Thread[CurThread].status == 2) {
Thread[CurThread].status = 1;
Thread[CurThread].func = ra;
memcpy(Thread[CurThread].reg, psxRegs.GPR.r, 32*4);
if (ThreadCB[CurThread].status == 2) {
ThreadCB[CurThread].status = 1;
ThreadCB[CurThread].func = ra;
memcpy(ThreadCB[CurThread].reg, psxRegs.GPR.r, 32*4);
}
memcpy(psxRegs.GPR.r, Thread[th].reg, 32*4);
pc0 = Thread[th].func;
Thread[th].status = 2;
memcpy(psxRegs.GPR.r, ThreadCB[th].reg, 32*4);
pc0 = ThreadCB[th].func;
ThreadCB[th].status = 2;
CurThread = th;
}
}
@@ -2021,26 +2026,27 @@ void psxBios_UnDeliverEvent() { // 0x20
PSXBIOS_LOG("psxBios_%s %x,%x\n", biosB0n[0x20], ev, spec);
#endif
if (Event[ev][spec].status == EvStALREADY &&
Event[ev][spec].mode == EvMdNOINTR)
Event[ev][spec].status = EvStACTIVE;
if (EventCB[ev][spec].status == EvStALREADY &&
EventCB[ev][spec].mode == EvMdNOINTR)
EventCB[ev][spec].status = EvStACTIVE;
pc0 = ra;
}
char ffile[64], *pfile;
int nfile;
static void buopen(int mcd, char *ptr, char *cfg)
{
int i;
char *fptr = ptr;
char *mcd_data = ptr;
strcpy(FDesc[1 + mcd].name, Ra0+5);
FDesc[1 + mcd].offset = 0;
FDesc[1 + mcd].mode = a1;
for (i=1; i<16; i++) {
fptr += 128;
const char *fptr = mcd_data + 128 * i;
if ((*fptr & 0xF0) != 0x50) continue;
if (strcmp(FDesc[1 + mcd].name, fptr+0xa)) continue;
FDesc[1 + mcd].mcfile = i;
@@ -2049,12 +2055,11 @@ static void buopen(int mcd, char *ptr, char *cfg)
break;
}
if (a1 & 0x200 && v0 == -1) { /* FCREAT */
fptr = ptr;
for (i=1; i<16; i++) {
int j, xor, nblk = a1 >> 16;
u8 *pptr, *fptr2;
char *pptr, *fptr2;
char *fptr = mcd_data + 128 * i;
fptr += 128;
if ((*fptr & 0xF0) != 0xa0) continue;
FDesc[1 + mcd].mcfile = i;
@@ -2064,12 +2069,12 @@ static void buopen(int mcd, char *ptr, char *cfg)
fptr[6] = 0x00;
fptr[7] = 0x00;
strcpy(fptr+0xa, FDesc[1 + mcd].name);
pptr = fptr2 = (u8 *)fptr;
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;
@@ -2107,7 +2112,7 @@ void psxBios_open() { // 0x32
v0 = -1;
if (pa0) {
if (pa0 != INVALID_PTR) {
if (!strncmp(pa0, "bu00", 4)) {
buopen(1, Mcd1Data, Config.Mcd1);
}
@@ -2161,13 +2166,13 @@ void psxBios_read() { // 0x34
v0 = -1;
if (pa1) {
if (pa1 != INVALID_PTR) {
switch (a0) {
case 2: buread(pa1, 1, a2); break;
case 3: buread(pa1, 2, a2); break;
}
}
pc0 = ra;
}
@@ -2184,7 +2189,7 @@ void psxBios_write() { // 0x35/0x03
#endif
v0 = -1;
if (!pa1) {
if (pa1 == INVALID_PTR) {
pc0 = ra;
return;
}
@@ -2233,7 +2238,7 @@ void psxBios_puts() { // 3e/3f
/* To avoid any issues with different behaviour when using the libc's own strlen instead.
* We want to mimic the PSX's behaviour in this case for bufile. */
static size_t strlen_internal(char* p)
static size_t strlen_internal(char* p)
{
size_t size_of_array = 0;
while (*p++) size_of_array++;
@@ -2274,7 +2279,7 @@ static size_t strlen_internal(char* p)
/*
* struct DIRENTRY* firstfile(char *name,struct DIRENTRY *dir);
*/
void psxBios_firstfile() { // 42
struct DIRENTRY *dir = (struct DIRENTRY *)Ra1;
void *pa0 = Ra0;
@@ -2288,7 +2293,7 @@ void psxBios_firstfile() { // 42
v0 = 0;
if (pa0) {
if (pa0 != INVALID_PTR) {
strcpy(ffile, pa0);
pfile = ffile+5;
nfile = 0;
@@ -2366,7 +2371,7 @@ void psxBios_rename() { // 44
v0 = 0;
if (pa0 && pa1) {
if (pa0 != INVALID_PTR && pa1 != INVALID_PTR) {
if (!strncmp(pa0, "bu00", 4) && !strncmp(pa1, "bu00", 4)) {
burename(1);
}
@@ -2408,7 +2413,7 @@ void psxBios_delete() { // 45
v0 = 0;
if (pa0) {
if (pa0 != INVALID_PTR) {
if (!strncmp(pa0, "bu00", 4)) {
budelete(1);
}
@@ -2471,7 +2476,7 @@ void psxBios__card_write() { // 0x4e
card_active_chan = a0;
port = a0 >> 4;
if (pa2) {
if (pa2 != INVALID_PTR) {
if (port == 0) {
memcpy(Mcd1Data + a1 * 128, pa2, 128);
SaveMcd(Config.Mcd1, Mcd1Data, a1 * 128, 128);
@@ -2507,7 +2512,7 @@ void psxBios__card_read() { // 0x4f
card_active_chan = a0;
port = a0 >> 4;
if (pa2) {
if (pa2 != INVALID_PTR) {
if (port == 0) {
memcpy(pa2, Mcd1Data + a1 * 128, 128);
} else {
@@ -2531,7 +2536,7 @@ void psxBios__new_card() { // 0x50
/* According to a user, this allows Final Fantasy Tactics to save/load properly */
void psxBios__get_error(void) // 55
{
{
v0 = 0;
pc0 = ra;
}
@@ -2607,7 +2612,7 @@ void psxBios__card_chan() { // 0x58
void psxBios_ChangeClearPad() { // 5b
#ifdef PSXBIOS_LOG
PSXBIOS_LOG("psxBios_%s: %x\n", biosB0n[0x5b], a0);
#endif
#endif
pc0 = ra;
}
@@ -2675,11 +2680,11 @@ void psxBios_ChangeClearRCnt() { // 0a
pc0 = ra;
}
void psxBios_dummy() {
void psxBios_dummy() {
#ifdef PSXBIOS_LOG
PSXBIOS_LOG("unk %x call: %x\n", pc0 & 0x1fffff, t1);
#endif
pc0 = ra;
pc0 = ra;
}
void (*biosA0[256])();
@@ -2690,7 +2695,7 @@ void (*biosC0[256])();
void psxBiosInit() {
u32 base, size;
u32 *ptr;
u32 *ptr;
int i;
uLongf len;
@@ -2773,7 +2778,7 @@ void psxBiosInit() {
biosA0[0x39] = psxBios_InitHeap;
//biosA0[0x3a] = psxBios__exit;
biosA0[0x3b] = psxBios_getchar;
biosA0[0x3c] = psxBios_putchar;
biosA0[0x3c] = psxBios_putchar;
//biosA0[0x3d] = psxBios_gets;
//biosA0[0x40] = psxBios_sys_a0_40;
//biosA0[0x41] = psxBios_LoadTest;
@@ -2789,7 +2794,7 @@ void psxBiosInit() {
biosA0[0x4b] = psxBios_GPU_SendPackets;
biosA0[0x4c] = psxBios_sys_a0_4c;
biosA0[0x4d] = psxBios_GPU_GetGPUStatus;
//biosA0[0x4e] = psxBios_GPU_sync;
//biosA0[0x4e] = psxBios_GPU_sync;
//biosA0[0x4f] = psxBios_sys_a0_4f;
//biosA0[0x50] = psxBios_sys_a0_50;
biosA0[0x51] = psxBios_LoadExec;
@@ -2841,10 +2846,10 @@ void psxBiosInit() {
//biosA0[0x7f] = psxBios_sys_a0_7f;
//biosA0[0x80] = psxBios_sys_a0_80;
//biosA0[0x81] = psxBios_sys_a0_81;
//biosA0[0x82] = psxBios_sys_a0_82;
//biosA0[0x82] = psxBios_sys_a0_82;
//biosA0[0x83] = psxBios_sys_a0_83;
//biosA0[0x84] = psxBios_sys_a0_84;
//biosA0[0x85] = psxBios__96_CdStop;
//biosA0[0x85] = psxBios__96_CdStop;
//biosA0[0x86] = psxBios_sys_a0_86;
//biosA0[0x87] = psxBios_sys_a0_87;
//biosA0[0x88] = psxBios_sys_a0_88;
@@ -2996,7 +3001,7 @@ void psxBiosInit() {
//biosC0[0x07] = psxBios_InstallExeptionHandler;
//biosC0[0x08] = psxBios_SysInitMemory;
//biosC0[0x09] = psxBios_SysInitKMem;
biosC0[0x0a] = psxBios_ChangeClearRCnt;
biosC0[0x0a] = psxBios_ChangeClearRCnt;
//biosC0[0x0b] = psxBios_SystemError;
//biosC0[0x0c] = psxBios_InitDefInt;
//biosC0[0x0d] = psxBios_sys_c0_0d;
@@ -3019,14 +3024,14 @@ void psxBiosInit() {
/**/
base = 0x1000;
size = sizeof(EvCB) * 32;
Event = (void *)&psxR[base]; base += size * 6;
memset(Event, 0, size * 6);
HwEV = Event;
EvEV = Event + 32;
RcEV = Event + 32 * 2;
UeEV = Event + 32 * 3;
SwEV = Event + 32 * 4;
ThEV = Event + 32 * 5;
EventCB = (void *)&psxR[base]; base += size * 6;
memset(EventCB, 0, size * 6);
HwEV = EventCB;
EvEV = EventCB + 32;
RcEV = EventCB + 32 * 2;
UeEV = EventCB + 32 * 3;
SwEV = EventCB + 32 * 4;
ThEV = EventCB + 32 * 5;
ptr = (u32 *)&psxM[0x0874]; // b0 table
ptr[0] = SWAPu32(0x4c54 - 0x884);
@@ -3035,8 +3040,8 @@ void psxBiosInit() {
ptr[6] = SWAPu32(0xc80);
memset(SysIntRP, 0, sizeof(SysIntRP));
memset(Thread, 0, sizeof(Thread));
Thread[0].status = 2; // main thread
memset(ThreadCB, 0, sizeof(ThreadCB));
ThreadCB[0].status = 2; // main thread
pad_stopped = 1;
jmp_int = NULL;
@@ -3064,7 +3069,7 @@ void psxBiosInit() {
*/
// opcode HLE
psxRu32ref(0x0000) = SWAPu32((0x3b << 26) | 4);
/* Whatever this does, it actually breaks CTR, even without the uninitiliazed memory patch.
/* Whatever this does, it actually breaks CTR, even without the uninitiliazed memory patch.
Normally games shouldn't read from address 0 yet they do. See explanation below in details. */
//psxMu32ref(0x0000) = SWAPu32((0x3b << 26) | 0);
psxMu32ref(0x00a0) = SWAPu32((0x3b << 26) | 1);
@@ -3092,14 +3097,14 @@ void psxBiosInit() {
psxHu32ref(0x1060) = SWAPu32(0x00000b88);
hleSoftCall = FALSE;
/* Some games like R-Types, CTR, Fade to Black read from adress 0x00000000 due to uninitialized pointers.
See Garbage Area at Address 00000000h in Nocash PSX Specfications for more information.
Here are some examples of games not working with this fix in place :
R-type won't get past the Irem logo if not implemented.
Crash Team Racing will softlock after the Sony logo.
*/
psxMu32ref(0x0000) = SWAPu32(0x00000003);
/*
But overwritten by 00000003h after soon.
@@ -3280,7 +3285,7 @@ void psxBiosException() {
break;
case 2: // ExitCritical - enable irq's
psxRegs.CP0.n.Status |= 0x404;
psxRegs.CP0.n.Status |= 0x404;
break;
/* Normally this should cover SYS(00h, SYS(04h but they don't do anything relevant so... */
default:
@@ -3339,7 +3344,7 @@ void psxBiosFreeze(int Mode) {
bfreezes(regs);
bfreezes(SysIntRP);
bfreezel(&CardState);
bfreezes(Thread);
bfreezes(ThreadCB);
bfreezel(&CurThread);
bfreezes(FDesc);
bfreezel(&card_active_chan);
+4
View File
@@ -51,7 +51,9 @@ extern "C" {
#include <math.h>
#include <time.h>
#include <ctype.h>
#ifndef __SWITCH__
#include <sys/types.h>
#endif
#include <assert.h>
// Define types
@@ -130,8 +132,10 @@ typedef struct {
boolean Mdec;
boolean PsxAuto;
boolean Cdda;
boolean AsyncCD;
boolean CHD_Precache; /* loads disk image into memory, works with CHD only. */
boolean HLE;
boolean SlowBoot;
boolean Debug;
boolean PsxOut;
boolean UseNet;
+1 -1
View File
@@ -376,7 +376,7 @@ void psxRcntUpdate()
psxRcntSet();
#ifndef NDEBUG
#if 0 //ndef NDEBUG
DebugVSync();
#endif
}
+5 -5
View File
@@ -45,7 +45,7 @@ void psxDma4(u32 madr, u32 bcr, u32 chcr) { // SPU
PSXDMA_LOG("*** DMA4 SPU - mem2spu *** %x addr = %x size = %x\n", chcr, madr, bcr);
#endif
ptr = (u16 *)PSXM(madr);
if (ptr == NULL) {
if (ptr == INVALID_PTR) {
#ifdef CPU_LOG
CPU_LOG("*** DMA4 SPU - mem2spu *** NULL Pointer!!!\n");
#endif
@@ -62,7 +62,7 @@ void psxDma4(u32 madr, u32 bcr, u32 chcr) { // SPU
PSXDMA_LOG("*** DMA4 SPU - spu2mem *** %x addr = %x size = %x\n", chcr, madr, bcr);
#endif
ptr = (u16 *)PSXM(madr);
if (ptr == NULL) {
if (ptr == INVALID_PTR) {
#ifdef CPU_LOG
CPU_LOG("*** DMA4 SPU - spu2mem *** NULL Pointer!!!\n");
#endif
@@ -137,7 +137,7 @@ void psxDma2(u32 madr, u32 bcr, u32 chcr) { // GPU
PSXDMA_LOG("*** DMA2 GPU - vram2mem *** %lx addr = %lx size = %lx\n", chcr, madr, bcr);
#endif
ptr = (u32 *)PSXM(madr);
if (ptr == NULL) {
if (ptr == INVALID_PTR) {
#ifdef CPU_LOG
CPU_LOG("*** DMA2 GPU - vram2mem *** NULL Pointer!!!\n");
#endif
@@ -159,7 +159,7 @@ void psxDma2(u32 madr, u32 bcr, u32 chcr) { // GPU
PSXDMA_LOG("*** DMA 2 - GPU mem2vram *** %lx addr = %lx size = %lx\n", chcr, madr, bcr);
#endif
ptr = (u32 *)PSXM(madr);
if (ptr == NULL) {
if (ptr == INVALID_PTR) {
#ifdef CPU_LOG
CPU_LOG("*** DMA2 GPU - mem2vram *** NULL Pointer!!!\n");
#endif
@@ -225,7 +225,7 @@ void psxDma6(u32 madr, u32 bcr, u32 chcr) {
#endif
if (chcr == 0x11000002) {
if (mem == NULL) {
if (mem == INVALID_PTR) {
#ifdef CPU_LOG
CPU_LOG("*** DMA6 OT *** NULL Pointer!!!\n");
#endif
+10 -4
View File
@@ -23,6 +23,12 @@
#include "psxhle.h"
#if 0
#define PSXHLE_LOG SysPrintf
#else
#define PSXHLE_LOG(...)
#endif
static void hleDummy() {
psxRegs.pc = psxRegs.GPR.n.ra;
@@ -54,10 +60,10 @@ static void hleC0() {
}
static void hleBootstrap() { // 0xbfc00000
SysPrintf("hleBootstrap\n");
PSXHLE_LOG("hleBootstrap\n");
CheckCdrom();
LoadCdrom();
SysPrintf("CdromLabel: \"%s\": PC = %8.8lx (SP = %8.8lx)\n", CdromLabel, psxRegs.pc, psxRegs.GPR.n.sp);
PSXHLE_LOG("CdromLabel: \"%s\": PC = %8.8lx (SP = %8.8lx)\n", CdromLabel, psxRegs.pc, psxRegs.GPR.n.sp);
}
typedef struct {
@@ -77,7 +83,7 @@ typedef struct {
static void hleExecRet() {
EXEC *header = (EXEC*)PSXM(psxRegs.GPR.n.s0);
SysPrintf("ExecRet %x: %x\n", psxRegs.GPR.n.s0, header->ret);
PSXHLE_LOG("ExecRet %x: %x\n", psxRegs.GPR.n.s0, header->ret);
psxRegs.GPR.n.ra = header->ret;
psxRegs.GPR.n.sp = header->_sp;
@@ -89,7 +95,7 @@ static void hleExecRet() {
psxRegs.pc = psxRegs.GPR.n.ra;
}
void (* const psxHLEt[])() = {
void (* const psxHLEt[8])() = {
hleDummy, hleA0, hleB0, hleC0,
hleBootstrap, hleExecRet,
hleDummy, hleDummy
+1 -1
View File
@@ -1101,7 +1101,7 @@ static void intExecute() {
execI_(memRLUT, regs_);
}
static void intExecuteBlock() {
void intExecuteBlock() {
psxRegisters *regs_ = &psxRegs;
u8 **memRLUT = psxMemRLUT;
+3
View File
@@ -8,4 +8,7 @@ void MTC0(psxRegisters *regs_, int reg, u32 val);
void gteNULL(struct psxCP2Regs *regs);
extern void (*psxCP2[64])(struct psxCP2Regs *regs);
// called by lightrec
void intExecuteBlock();
#endif // __PSXINTERPRETER_H__
+84 -36
View File
@@ -30,8 +30,13 @@
//#include "debug.h"
#define DebugCheckBP(...)
#include "lightrec/mem.h"
#include "memmap.h"
#ifdef USE_LIBRETRO_VFS
#include <streams/file_stream_transforms.h>
#endif
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
@@ -52,7 +57,7 @@ retry:
if (psxMapHook != NULL) {
ret = psxMapHook(addr, size, 0, tag);
if (ret == NULL)
return NULL;
return MAP_FAILED;
}
else {
/* avoid MAP_FIXED, it overrides existing mappings.. */
@@ -62,7 +67,7 @@ retry:
req = (void *)(uintptr_t)addr;
ret = mmap(req, size, PROT_READ | PROT_WRITE, flags, -1, 0);
if (ret == MAP_FAILED)
return NULL;
return ret;
}
if (addr != 0 && ret != (void *)(uintptr_t)addr) {
@@ -71,7 +76,7 @@ retry:
if (is_fixed) {
psxUnmap(ret, size, tag);
return NULL;
return MAP_FAILED;
}
if (((addr ^ (unsigned long)(uintptr_t)ret) & ~0xff000000l) && try_ < 2)
@@ -128,33 +133,71 @@ u8 **psxMemRLUT = NULL;
0xbfc0_0000-0xbfc7_ffff BIOS Mirror (512K) Uncached
*/
int psxMemInit() {
int i;
psxMemRLUT = (u8 **)malloc(0x10000 * sizeof(void *));
psxMemWLUT = (u8 **)malloc(0x10000 * sizeof(void *));
memset(psxMemRLUT, 0, 0x10000 * sizeof(void *));
memset(psxMemWLUT, 0, 0x10000 * sizeof(void *));
static int psxMemInitMap(void)
{
psxM = psxMap(0x80000000, 0x00210000, 1, MAP_TAG_RAM);
if (psxM == NULL)
if (psxM == MAP_FAILED)
psxM = psxMap(0x77000000, 0x00210000, 0, MAP_TAG_RAM);
if (psxM == NULL) {
if (psxM == MAP_FAILED) {
SysMessage(_("mapping main RAM failed"));
psxM = NULL;
return -1;
}
psxP = &psxM[0x200000];
psxH = psxMap(0x1f800000, 0x10000, 0, MAP_TAG_OTHER);
psxR = psxMap(0x1fc00000, 0x80000, 0, MAP_TAG_OTHER);
if (psxMemRLUT == NULL || psxMemWLUT == NULL ||
psxR == NULL || psxP == NULL || psxH == NULL) {
psxH = psxMap(0x1f800000, 0x10000, 0, MAP_TAG_OTHER);
if (psxH == MAP_FAILED) {
SysMessage(_("Error allocating memory!"));
psxMemShutdown();
return -1;
}
psxR = psxMap(0x1fc00000, 0x80000, 0, MAP_TAG_OTHER);
if (psxR == MAP_FAILED) {
SysMessage(_("Error allocating memory!"));
psxMemShutdown();
return -1;
}
return 0;
}
static void psxMemFreeMap(void)
{
if (psxM) psxUnmap(psxM, 0x00210000, MAP_TAG_RAM);
if (psxH) psxUnmap(psxH, 0x10000, MAP_TAG_OTHER);
if (psxR) psxUnmap(psxR, 0x80000, MAP_TAG_OTHER);
psxM = psxH = psxR = NULL;
psxP = NULL;
}
int psxMemInit(void)
{
unsigned int i;
int ret;
if (LIGHTREC_CUSTOM_MAP)
ret = lightrec_init_mmap();
else
ret = psxMemInitMap();
if (ret) {
SysMessage(_("Error allocating memory!"));
psxMemShutdown();
return -1;
}
psxMemRLUT = (u8 **)malloc(0x10000 * sizeof(void *));
psxMemWLUT = (u8 **)malloc(0x10000 * sizeof(void *));
if (psxMemRLUT == NULL || psxMemWLUT == NULL) {
SysMessage(_("Error allocating memory!"));
psxMemShutdown();
return -1;
}
memset(psxMemRLUT, (uintptr_t)INVALID_PTR, 0x10000 * sizeof(void *));
memset(psxMemWLUT, (uintptr_t)INVALID_PTR, 0x10000 * sizeof(void *));
// MemR
for (i = 0; i < 0x80; i++) psxMemRLUT[i + 0x0000] = (u8 *)&psxM[(i & 0x1f) << 16];
@@ -179,7 +222,7 @@ int psxMemInit() {
// NOTE: Not sure if this is needed to fix any games but seems wise,
// seeing as some games do read from PIO as part of copy-protection
// check. (See fix in psxMemReset() regarding psxP region reads).
psxMemWLUT[0x1f00] = NULL;
psxMemWLUT[0x1f00] = INVALID_PTR;
psxMemWLUT[0x1f80] = (u8 *)psxH;
return 0;
@@ -192,6 +235,8 @@ void psxMemReset() {
memset(psxM, 0, 0x00200000);
memset(psxP, 0xff, 0x00010000);
Config.HLE = TRUE;
if (strcmp(Config.Bios, "HLE") != 0) {
sprintf(bios, "%s/%s", Config.BiosDir, Config.Bios);
f = fopen(bios, "rb");
@@ -199,19 +244,22 @@ void psxMemReset() {
if (f == NULL) {
SysMessage(_("Could not open BIOS:\"%s\". Enabling HLE Bios!\n"), bios);
memset(psxR, 0, 0x80000);
Config.HLE = TRUE;
} else {
fread(psxR, 1, 0x80000, f);
if (fread(psxR, 1, 0x80000, f) == 0x80000) {
Config.HLE = FALSE;
} else {
SysMessage(_("The selected BIOS:\"%s\" is of wrong size. Enabling HLE Bios!\n"), bios);
}
fclose(f);
Config.HLE = FALSE;
}
} else Config.HLE = TRUE;
}
}
void psxMemShutdown() {
psxUnmap(psxM, 0x00210000, MAP_TAG_RAM); psxM = NULL;
psxUnmap(psxH, 0x10000, MAP_TAG_OTHER); psxH = NULL;
psxUnmap(psxR, 0x80000, MAP_TAG_OTHER); psxR = NULL;
if (LIGHTREC_CUSTOM_MAP)
lightrec_free_mmap();
else
psxMemFreeMap();
free(psxMemRLUT); psxMemRLUT = NULL;
free(psxMemWLUT); psxMemWLUT = NULL;
@@ -231,7 +279,7 @@ u8 psxMemRead8(u32 mem) {
return psxHwRead8(mem);
} else {
p = (char *)(psxMemRLUT[t]);
if (p != NULL) {
if (p != INVALID_PTR) {
if (Config.Debug)
DebugCheckBP((mem & 0xffffff) | 0x80000000, R1);
return *(u8 *)(p + (mem & 0xffff));
@@ -256,7 +304,7 @@ u16 psxMemRead16(u32 mem) {
return psxHwRead16(mem);
} else {
p = (char *)(psxMemRLUT[t]);
if (p != NULL) {
if (p != INVALID_PTR) {
if (Config.Debug)
DebugCheckBP((mem & 0xffffff) | 0x80000000, R2);
return SWAPu16(*(u16 *)(p + (mem & 0xffff)));
@@ -281,7 +329,7 @@ u32 psxMemRead32(u32 mem) {
return psxHwRead32(mem);
} else {
p = (char *)(psxMemRLUT[t]);
if (p != NULL) {
if (p != INVALID_PTR) {
if (Config.Debug)
DebugCheckBP((mem & 0xffffff) | 0x80000000, R4);
return SWAPu32(*(u32 *)(p + (mem & 0xffff)));
@@ -306,7 +354,7 @@ void psxMemWrite8(u32 mem, u8 value) {
psxHwWrite8(mem, value);
} else {
p = (char *)(psxMemWLUT[t]);
if (p != NULL) {
if (p != INVALID_PTR) {
if (Config.Debug)
DebugCheckBP((mem & 0xffffff) | 0x80000000, W1);
*(u8 *)(p + (mem & 0xffff)) = value;
@@ -333,7 +381,7 @@ void psxMemWrite16(u32 mem, u16 value) {
psxHwWrite16(mem, value);
} else {
p = (char *)(psxMemWLUT[t]);
if (p != NULL) {
if (p != INVALID_PTR) {
if (Config.Debug)
DebugCheckBP((mem & 0xffffff) | 0x80000000, W2);
*(u16 *)(p + (mem & 0xffff)) = SWAPu16(value);
@@ -361,7 +409,7 @@ void psxMemWrite32(u32 mem, u32 value) {
psxHwWrite32(mem, value);
} else {
p = (char *)(psxMemWLUT[t]);
if (p != NULL) {
if (p != INVALID_PTR) {
if (Config.Debug)
DebugCheckBP((mem & 0xffffff) | 0x80000000, W4);
*(u32 *)(p + (mem & 0xffff)) = SWAPu32(value);
@@ -385,9 +433,9 @@ void psxMemWrite32(u32 mem, u32 value) {
case 0x800: case 0x804:
if (writeok == 0) break;
writeok = 0;
memset(psxMemWLUT + 0x0000, 0, 0x80 * sizeof(void *));
memset(psxMemWLUT + 0x8000, 0, 0x80 * sizeof(void *));
memset(psxMemWLUT + 0xa000, 0, 0x80 * sizeof(void *));
memset(psxMemWLUT + 0x0000, (uintptr_t)INVALID_PTR, 0x80 * sizeof(void *));
memset(psxMemWLUT + 0x8000, (uintptr_t)INVALID_PTR, 0x80 * sizeof(void *));
memset(psxMemWLUT + 0xa000, (uintptr_t)INVALID_PTR, 0x80 * sizeof(void *));
/* Required for icache interpreter otherwise Armored Core won't boot on icache interpreter */
psxCpu->Notify(R3000ACPU_NOTIFY_CACHE_ISOLATED, NULL);
break;
@@ -423,7 +471,7 @@ void *psxMemPointer(u32 mem) {
return NULL;
} else {
p = (char *)(psxMemWLUT[t]);
if (p != NULL) {
if (p != INVALID_PTR) {
return (void *)(p + (mem & 0xffff));
}
return NULL;
+7 -1
View File
@@ -46,6 +46,12 @@ extern "C" {
#endif
#ifdef LIGHTREC
#define INVALID_PTR ((void *)-1)
#else
#define INVALID_PTR NULL
#endif
extern s8 *psxM;
#define psxMs8(mem) psxM[(mem) & 0x1fffff]
#define psxMs16(mem) (SWAP16(*(s16 *)&psxM[(mem) & 0x1fffff]))
@@ -109,7 +115,7 @@ extern s8 *psxH;
extern u8 **psxMemWLUT;
extern u8 **psxMemRLUT;
#define PSXM(mem) (psxMemRLUT[(mem) >> 16] == 0 ? NULL : (u8*)(psxMemRLUT[(mem) >> 16] + ((mem) & 0xffff)))
#define PSXM(mem) (psxMemRLUT[(mem) >> 16] == INVALID_PTR ? INVALID_PTR : (u8*)(psxMemRLUT[(mem) >> 16] + ((mem) & 0xffff)))
#define PSXMs8(mem) (*(s8 *)PSXM(mem))
#define PSXMs16(mem) (SWAP16(*(s16 *)PSXM(mem)))
#define PSXMs32(mem) (SWAP32(*(s32 *)PSXM(mem)))
+3 -2
View File
@@ -33,7 +33,7 @@ psxRegisters psxRegs;
#endif
int psxInit() {
SysPrintf(_("Running PCSX Version %s (%s).\n"), PACKAGE_VERSION, __DATE__);
SysPrintf(_("Running PCSX Version %s (%s).\n"), PCSX_VERSION, __DATE__);
#ifndef DRC_DISABLE
if (Config.Cpu == CPU_INTERPRETER) {
@@ -77,10 +77,11 @@ void psxReset() {
}
void psxShutdown() {
psxMemShutdown();
psxBiosShutdown();
psxCpu->Shutdown();
psxMemShutdown();
}
void psxException(u32 code, u32 bd) {
+22 -2
View File
@@ -24,6 +24,10 @@
#include "sio.h"
#include <sys/stat.h>
#ifdef USE_LIBRETRO_VFS
#include <streams/file_stream_transforms.h>
#endif
// Status Flags
#define TX_RDY 0x0001
#define RX_RDY 0x0002
@@ -407,6 +411,12 @@ void LoadMcd(int mcd, char *str) {
}
McdDisable[mcd - 1] = 0;
#ifdef HAVE_LIBRETRO
// memcard1 is handled by libretro
if (mcd == 1)
return;
#endif
if (str == NULL || strcmp(str, "none") == 0) {
McdDisable[mcd - 1] = 1;
return;
@@ -428,7 +438,12 @@ void LoadMcd(int mcd, char *str) {
else if(buf.st_size == MCD_SIZE + 3904)
fseek(f, 3904, SEEK_SET);
}
fread(data, 1, MCD_SIZE, f);
if (fread(data, 1, MCD_SIZE, f) != MCD_SIZE) {
#ifndef NDEBUG
SysPrintf(_("File IO error in <%s:%s>.\n"), __FILE__, __func__);
#endif
memset(data, 0x00, MCD_SIZE);
}
fclose(f);
}
else
@@ -443,7 +458,12 @@ void LoadMcd(int mcd, char *str) {
else if(buf.st_size == MCD_SIZE + 3904)
fseek(f, 3904, SEEK_SET);
}
fread(data, 1, MCD_SIZE, f);
if (fread(data, 1, MCD_SIZE, f) != MCD_SIZE) {
#ifndef NDEBUG
SysPrintf(_("File IO error in <%s:%s>.\n"), __FILE__, __func__);
#endif
memset(data, 0x00, MCD_SIZE);
}
fclose(f);
}
}
+5
View File
@@ -21,6 +21,9 @@
// Converted to binary format by Wei Mingzhi <[email protected]>.
//
#ifndef __SJISFONT_H__
#define __SJISFONT_H__
const unsigned char font_8140[] = {
0x78, 0xda, 0xad, 0x3b, 0x3b, 0x90, 0x1b, 0xc9,
0x75, 0x3d, 0x9f, 0x05, 0x1a, 0xcb, 0xe1, 0x4e,
@@ -6954,3 +6957,5 @@ const unsigned char font_889f[] = {
0xeb, 0xe7, 0xa8, 0x89, 0x0a, 0x11, 0xbc, 0xbc,
0x33, 0xf9, 0xff, 0xe8, 0xc4, 0x21, 0xbf
};
#endif /* __SJISFONT_H__ */
+18 -1
View File
@@ -15,6 +15,22 @@
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
#ifdef NO_SOCKET
int StartServer() { return 0;}
void StopServer() {}
void GetClient() {}
void CloseClient() {}
int HasClient() { return 0;}
int ReadSocket(char * buffer, int len) { return 0;}
int RawReadSocket(char * buffer, int len) { return 0;}
void WriteSocket(char * buffer, int len) {}
void SetsBlock() {}
void SetsNonblock() {}
#else // NO_SOCKET
#ifdef _WIN32
#include <winsock2.h>
#endif
@@ -119,7 +135,7 @@ void GetClient() {
}
#endif
sprintf(hello, "000 PCSX Version %s - Debug console\r\n", PACKAGE_VERSION);
sprintf(hello, "000 PCSX Version %s - Debug console\r\n", PCSX_VERSION);
WriteSocket(hello, strlen(hello));
ptr = 0;
}
@@ -252,3 +268,4 @@ void SetsNonblock() {
fcntl(server_socket, F_SETFL, flags | O_NONBLOCK);
#endif
}
#endif // NO_SOCKET
+1 -1
View File
@@ -284,7 +284,7 @@ static long CDRinit(void)
return -1;
}
}
#ifndef _WIN32
#if !defined(_WIN32) && !defined(NO_DYLIB)
if (pBZ2_bzBuffToBuffDecompress == NULL) {
void *h = dlopen("/usr/lib/libbz2.so.1", RTLD_LAZY);
if (h == NULL)
+4
View File
@@ -1,3 +1,7 @@
#ifndef __P_CDRCIMG_H__
#define __P_CDRCIMG_H__
void cdrcimg_set_fname(const char *fname);
void *cdrcimg_get_sym(const char *sym);
#endif /* __P_CDRCIMG_H__ */
+4
View File
@@ -1,3 +1,5 @@
#ifndef __P_EXTERNALS_H__
#define __P_EXTERNALS_H__
void dfinput_activate(void);
@@ -12,3 +14,5 @@ extern void pl_update_gun(int *xn, int *yn, int *xres, int *yres, int *in);
/* vibration trigger to frontend */
extern int in_enable_vibration;
extern void plat_trigger_vibrate(int pad, int low, int high);
#endif /* __P_EXTERNALS_H__ */
+14
View File
@@ -20,6 +20,8 @@ extern unsigned char CALLBACK PAD2__startPoll(int pad);
extern unsigned char CALLBACK PAD1__poll(unsigned char value);
extern unsigned char CALLBACK PAD2__poll(unsigned char value);
#ifndef HAVE_LIBRETRO
static int old_controller_type1 = -1, old_controller_type2 = -1;
#define select_pad(n) \
@@ -37,6 +39,7 @@ static int old_controller_type1 = -1, old_controller_type2 = -1;
PAD##n##_poll = PADpoll_guncon; \
guncon_init(); \
break; \
case PSE_PAD_TYPE_NEGCON: \
case PSE_PAD_TYPE_GUN: \
default: \
PAD##n##_startPoll = PAD##n##__startPoll; \
@@ -49,9 +52,20 @@ void dfinput_activate(void)
{
PadDataS pad;
pad.portMultitap = -1;
pad.requestPadIndex = 0;
PAD1_readPort1(&pad);
select_pad(1);
pad.requestPadIndex = 1;
PAD2_readPort2(&pad);
select_pad(2);
}
#else // use libretro's libpcsxcore/plugins.c code
void dfinput_activate(void)
{
}
#endif
+5
View File
@@ -1,3 +1,6 @@
#ifndef __P_MAIN_H__
#define __P_MAIN_H__
#include "psemu_plugin_defs.h"
#include "externals.h"
@@ -16,3 +19,5 @@ void guncon_init(void);
/* get button state and pad type from main emu */
extern long (*PAD1_readPort1)(PadDataS *pad);
extern long (*PAD2_readPort2)(PadDataS *pad);
#endif /* __P_MAIN_H__ */
+4
View File
@@ -42,6 +42,7 @@ enum {
CMD_VIBRATION_TOGGLE = 0x4D,
};
#ifndef HAVE_LIBRETRO
static struct {
uint8_t PadMode;
uint8_t PadID;
@@ -242,6 +243,7 @@ static void do_vibration(unsigned char value)
break;
}
}
#endif
#if 0
#include <stdio.h>
@@ -254,6 +256,7 @@ unsigned char PADpoll(unsigned char value) {
#define PADpoll PADpoll_
#endif
#ifndef HAVE_LIBRETRO
unsigned char PADpoll_pad(unsigned char value) {
if (CurByte == 0) {
CurCmd = value;
@@ -302,3 +305,4 @@ void pad_init(void)
padstate[i].PadMode = padstate[i].pad.controllerType == PSE_PAD_TYPE_ANALOGPAD;
}
}
#endif
+4
View File
@@ -24,8 +24,12 @@
//
//*************************************************************************//
#ifndef __P_DMA_H__
#define __P_DMA_H__
unsigned short CALLBACK SPUreadDMA(void);
void CALLBACK SPUreadDMAMem(unsigned short * pusPSXMem,int iSize);
void CALLBACK SPUwriteDMA(unsigned short val);
void CALLBACK SPUwriteDMAMem(unsigned short * pusPSXMem,int iSize);
#endif /* __P_DMA_H__ */
+4
View File
@@ -15,6 +15,9 @@
* *
***************************************************************************/
#ifndef __P_SOUND_EXTERNALS_H__
#define __P_SOUND_EXTERNALS_H__
#include <stdint.h>
/////////////////////////////////////////////////////////
@@ -259,3 +262,4 @@ void schedule_next_irq(void);
#endif
#endif /* __P_SOUND_EXTERNALS_H__ */
+4
View File
@@ -1,3 +1,5 @@
#ifndef __P_OUT_H__
#define __P_OUT_H__
struct out_driver {
const char *name;
@@ -10,3 +12,5 @@ struct out_driver {
extern struct out_driver *out_current;
void SetupSound(void);
#endif /* __P_OUT_H__ */
+4
View File
@@ -15,6 +15,9 @@
* *
***************************************************************************/
#ifndef __P_REGISTERS_H__
#define __P_REGISTERS_H__
#define H_SPUReverbAddr 0x0da2
#define H_SPUirqAddr 0x0da4
#define H_SPUaddr 0x0da6
@@ -154,3 +157,4 @@
void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val, unsigned int cycles);
#endif /* __P_REGISTERS_H__ */
+5
View File
@@ -15,6 +15,11 @@
* *
***************************************************************************/
#ifndef __P_SPU_H__
#define __P_SPU_H__
void ClearWorkingState(void);
void CALLBACK SPUplayADPCMchannel(xa_decode_t *xap, unsigned int cycle, int is_start);
int CALLBACK SPUplayCDDAchannel(short *pcm, int bytes, unsigned int cycle, int is_start);
#endif /* __P_SPU_H__ */
+5
View File
@@ -1,3 +1,6 @@
#ifndef __P_SPU_C64X_H__
#define __P_SPU_C64X_H__
#define COMPONENT_NAME "pcsxr_spu"
enum {
@@ -26,3 +29,5 @@ struct region_mem {
};
#define ACTIVE_CNT 3
#endif /* __P_SPU_C64X_H__ */
+5
View File
@@ -1,3 +1,6 @@
#ifndef __P_SPU_CONFIG_H__
#define __P_SPU_CONFIG_H__
// user settings
typedef struct
@@ -15,3 +18,5 @@ typedef struct
} SPUConfig;
extern SPUConfig spu_config;
#endif /* __P_SPU_CONFIG_H__ */
+5
View File
@@ -15,6 +15,9 @@
* *
***************************************************************************/
#ifndef __P_STDAFX_H__
#define __P_STDAFX_H__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -30,3 +33,5 @@
#endif
#include "psemuxa.h"
#endif /* __P_STDAFX_H__ */
+6 -1
View File
@@ -15,6 +15,11 @@
* *
***************************************************************************/
#ifndef __P_XA_H__
#define __P_XA_H__
INLINE void MixXA(void);
INLINE void FeedXA(xa_decode_t *xap);
INLINE int FeedCDDA(unsigned char *pcm, int nBytes);
INLINE int FeedCDDA(unsigned char *pcm, int nBytes);
#endif /* __P_XA_H__ */
+3 -3
View File
@@ -301,11 +301,11 @@ void renderer_notify_res_change(void)
extern const unsigned char cmd_lengths[256];
int do_cmd_list(unsigned int *list, int list_len, int *last_cmd)
int do_cmd_list(uint32_t *list, int list_len, int *last_cmd)
{
unsigned int cmd = 0, len;
unsigned int *list_start = list;
unsigned int *list_end = list + list_len;
uint32_t *list_start = list;
uint32_t *list_end = list + list_len;
for (; list < list_end; list += 1 + len)
{
+8 -2
View File
@@ -6317,6 +6317,7 @@ static void DrawSoftwareSpriteMirror(unsigned char * baseAddr,int32_t w,int32_t
sprtYa=(sprtY<<10);
clutP=(clutY0<<10)+clutX0;
for (sprCY=0;sprCY<sprtH;sprCY++)
{
for (sprCX=0;sprCX<sprtW;sprCX++)
{
tC= psxVub[((textY0+(sprCY*lYDir))<<11) + textX0 +(sprCX*lXDir)];
@@ -6324,28 +6325,33 @@ static void DrawSoftwareSpriteMirror(unsigned char * baseAddr,int32_t w,int32_t
GetTextureTransColG_SPR(&psxVuw[sprA],GETLE16(&psxVuw[clutP+((tC>>4)&0xf)]));
GetTextureTransColG_SPR(&psxVuw[sprA+1],GETLE16(&psxVuw[clutP+(tC&0xf)]));
}
}
return;
case 1:
clutP>>=1;
for(sprCY=0;sprCY<sprtH;sprCY++)
{
for(sprCX=0;sprCX<sprtW;sprCX++)
{
tC = psxVub[((textY0+(sprCY*lYDir))<<11)+(GlobalTextAddrX<<1) + textX0 + (sprCX*lXDir)] & 0xff;
GetTextureTransColG_SPR(&psxVuw[((sprtY+sprCY)<<10)+sprtX + sprCX],psxVuw[clutP+tC]);
}
return;
}
return;
case 2:
for (sprCY=0;sprCY<sprtH;sprCY++)
{
for (sprCX=0;sprCX<sprtW;sprCX++)
{
GetTextureTransColG_SPR(&psxVuw[((sprtY+sprCY)<<10)+sprtX+sprCX],
GETLE16(&psxVuw[((textY0+(sprCY*lYDir))<<10)+GlobalTextAddrX + textX0 +(sprCX*lXDir)]));
}
return;
}
return;
}
}
@@ -1,3 +1,6 @@
#ifndef __P_PSX_GPU_OFFSETS_H__
#define __P_PSX_GPU_OFFSETS_H__
#define psx_gpu_test_mask_offset 0x0
#define psx_gpu_uvrg_offset 0x10
#define psx_gpu_uvrg_dx_offset 0x20
@@ -56,3 +59,5 @@
#define psx_gpu_texture_4bpp_cache_offset 0x5a00
#define psx_gpu_texture_8bpp_even_cache_offset 0x205a00
#define psx_gpu_texture_8bpp_odd_cache_offset 0x305a00
#endif /* __P_PSX_GPU_OFFSETS_H__ */
+66 -1
View File
@@ -868,7 +868,72 @@ extern void scale2x_tiles8(void *dst, const void *src, int w8, int h);
#ifndef NEON_BUILD
// TODO?
void scale2x_tiles8(void *dst, const void *src, int w8, int h) {}
void scale2x_tiles8(void *dst, const void *src, int w8, int h)
{
uint16_t* d = (uint16_t*)dst;
const uint16_t* s = (const uint16_t*)src;
while ( h-- )
{
uint16_t* d_save = d;
const uint16_t* s_save = s;
int w = w8;
while ( w-- )
{
d[ 0 ] = *s;
d[ 1 ] = *s;
d[ 1024 ] = *s;
d[ 1025 ] = *s;
d += 2; s++;
d[ 0 ] = *s;
d[ 1 ] = *s;
d[ 1024 ] = *s;
d[ 1025 ] = *s;
d += 2; s++;
d[ 0 ] = *s;
d[ 1 ] = *s;
d[ 1024 ] = *s;
d[ 1025 ] = *s;
d += 2; s++;
d[ 0 ] = *s;
d[ 1 ] = *s;
d[ 1024 ] = *s;
d[ 1025 ] = *s;
d += 2; s++;
d[ 0 ] = *s;
d[ 1 ] = *s;
d[ 1024 ] = *s;
d[ 1025 ] = *s;
d += 2; s++;
d[ 0 ] = *s;
d[ 1 ] = *s;
d[ 1024 ] = *s;
d[ 1025 ] = *s;
d += 2; s++;
d[ 0 ] = *s;
d[ 1 ] = *s;
d[ 1024 ] = *s;
d[ 1025 ] = *s;
d += 2; s++;
d[ 0 ] = *s;
d[ 1 ] = *s;
d[ 1024 ] = *s;
d[ 1025 ] = *s;
d += 2; s++;
}
d = d_save + 2048;
s = s_save + 1024; /* or 512? */
}
}
#endif
static int disable_main_render;
+5
View File
@@ -8,6 +8,9 @@
* See the COPYING file in the top-level directory.
*/
#ifndef __GPULIB_GPU_H__
#define __GPULIB_GPU_H__
#include <stdint.h>
#ifdef __cplusplus
@@ -135,3 +138,5 @@ void GPUrearmedCallbacks(const struct rearmed_cbs *cbs_);
#ifdef __cplusplus
}
#endif
#endif /* __GPULIB_GPU_H__ */
+1 -1
View File
@@ -54,7 +54,7 @@ void vout_update(void)
int i;
SDL_LockSurface(screen);
if (gpu.status.rgb24)
if (gpu.status & PSX_GPU_STATUS_RGB24)
{
uint8_t *s;
int y;
+4
View File
@@ -1,3 +1,6 @@
#ifndef __SPUNULL_REGISTER_H__
#define __SPUNULL_REGISTER_H__
#define H_SPUirqAddr 0x0da4
#define H_SPUaddr 0x0da6
#define H_SPUdata 0x0da8
@@ -119,3 +122,4 @@
#define H_SPU_ADSRLevel22 0x0d68
#define H_SPU_ADSRLevel23 0x0d78
#endif /* __SPUNULL_REGISTER_H__ */