From d4177037bbbca5f8ce2531fa7fe080b6b7e5ddc2 Mon Sep 17 00:00:00 2001
From: infvaL <38145742+infval@users.noreply.github.com>
Date: Fri, 13 Apr 2018 23:19:16 +0300
Subject: [PATCH] More palettes, more sample rates, bugfixes
* Add default FCEU palette and palettes from libretro.
* Sound has 4 options: off, 11025Hz, 22050Hz, 44100Hz.
* VS. UniSystem uses proper palette (default FCEU).
* Button L3 "Insert Coin" (VS. UniSystem).
* Fix memory usage when selecting palette.
---
README.md | 6 +-
src/drivers/ps2/browser.c | 4 +-
src/drivers/ps2/cnfsettings.c | 4 +-
src/drivers/ps2/init.c | 8 +-
src/drivers/ps2/main.c | 405 +++++++++++++++++++++++++++++-----
src/drivers/ps2/menu.c | 58 ++---
src/drivers/ps2/ps2fceu.h | 20 +-
src/drivers/ps2/ps2input.c | 21 +-
8 files changed, 409 insertions(+), 117 deletions(-)
diff --git a/README.md b/README.md
index 89b08d5..90c251f 100644
--- a/README.md
+++ b/README.md
@@ -3,10 +3,10 @@ FCEUmm-PS2
[Download](https://github.com/infval/Fceumm-PS2/releases) binary release (ELF file).
+AKuHAK's [release notes](http://psx-scene.com/forums/f176/fceu-mm-ps2-new-version-118166/).
## Extra features
* Multitap support up to 4 players
* Separate turbo buttons
-
## Controls
### In-game
@@ -15,14 +15,14 @@ Action | Button | Action | Button | Action | Button
B | ![Square](https://user-images.githubusercontent.com/38145742/38648065-120deeb8-3df8-11e8-984b-cccab8dd4622.png) | Select | ![Select](https://user-images.githubusercontent.com/38145742/38648134-65d593ca-3df8-11e8-9926-44357e5c44cd.png) | Start | ![Start](https://user-images.githubusercontent.com/38145742/38648145-717997d0-3df8-11e8-99b0-f98a75fc682b.png)
A | ![Cross](https://user-images.githubusercontent.com/38145742/38648019-e30fd27a-3df7-11e8-8e6b-660cdf65b9f6.png) | Menu | ![L1](https://user-images.githubusercontent.com/38145742/38646430-9b548400-3df0-11e8-9158-e6d77afd2115.png) | `---` | ![R1](https://user-images.githubusercontent.com/38145742/38648091-2a2bbe76-3df8-11e8-9894-c53092ee8557.png)
Turbo B | ![Triangle](https://user-images.githubusercontent.com/38145742/38646514-f0d0f2ec-3df0-11e8-9ff6-968a9f43ba9b.png) | Load State | ![L2](https://user-images.githubusercontent.com/38145742/38648101-3684328e-3df8-11e8-83b6-a17a6bb076a9.png) | Save State | ![R2](https://user-images.githubusercontent.com/38145742/38648109-4039008e-3df8-11e8-9171-1b6bacb38091.png)
-Turbo A | ![Circle](https://user-images.githubusercontent.com/38145742/38646507-eef3b536-3df0-11e8-8057-c4f8dd361eba.png) | FDS Disk Swap | ![L3](https://user-images.githubusercontent.com/38145742/38648117-4e97d3d0-3df8-11e8-9278-bc95530fad35.png) | FDS Side Swap | ![R3](https://user-images.githubusercontent.com/38145742/38648122-5b92778e-3df8-11e8-82ea-2eadfcd8764a.png)
+Turbo A | ![Circle](https://user-images.githubusercontent.com/38145742/38646507-eef3b536-3df0-11e8-8057-c4f8dd361eba.png) | FDS Disk Swap
VS. Insert Coin | ![L3](https://user-images.githubusercontent.com/38145742/38648117-4e97d3d0-3df8-11e8-9278-bc95530fad35.png) | FDS Side Swap | ![R3](https://user-images.githubusercontent.com/38145742/38648122-5b92778e-3df8-11e8-82ea-2eadfcd8764a.png)
D-pad: D-pad or Analog stick
### Browser
Action | Button | Action | Button | Action | Button
------ | :----: | ------ | :----: | ------ | :----:
-`---` | ![Square](https://user-images.githubusercontent.com/38145742/38648065-120deeb8-3df8-11e8-984b-cccab8dd4622.png) | Options | ![Select](https://user-images.githubusercontent.com/38145742/38648134-65d593ca-3df8-11e8-9926-44357e5c44cd.png) | Confirm save path, center screen | ![Start](https://user-images.githubusercontent.com/38145742/38648145-717997d0-3df8-11e8-99b0-f98a75fc682b.png)
+`---` | ![Square](https://user-images.githubusercontent.com/38145742/38648065-120deeb8-3df8-11e8-984b-cccab8dd4622.png) | Options | ![Select](https://user-images.githubusercontent.com/38145742/38648134-65d593ca-3df8-11e8-9926-44357e5c44cd.png) | Confirm save path,
center screen | ![Start](https://user-images.githubusercontent.com/38145742/38648145-717997d0-3df8-11e8-99b0-f98a75fc682b.png)
`---` | ![Cross](https://user-images.githubusercontent.com/38145742/38648019-e30fd27a-3df7-11e8-8e6b-660cdf65b9f6.png) | Menu | ![L1](https://user-images.githubusercontent.com/38145742/38646430-9b548400-3df0-11e8-9158-e6d77afd2115.png) | `---` | ![R1](https://user-images.githubusercontent.com/38145742/38648091-2a2bbe76-3df8-11e8-9894-c53092ee8557.png)
Back | ![Triangle](https://user-images.githubusercontent.com/38145742/38646514-f0d0f2ec-3df0-11e8-9ff6-968a9f43ba9b.png) | `---` | ![L2](https://user-images.githubusercontent.com/38145742/38648101-3684328e-3df8-11e8-83b6-a17a6bb076a9.png) | `---` | ![R2](https://user-images.githubusercontent.com/38145742/38648109-4039008e-3df8-11e8-9171-1b6bacb38091.png)
OK | ![Circle](https://user-images.githubusercontent.com/38145742/38646507-eef3b536-3df0-11e8-8057-c4f8dd361eba.png) | `---` | ![L3](https://user-images.githubusercontent.com/38145742/38648117-4e97d3d0-3df8-11e8-9278-bc95530fad35.png) | `---` | ![R3](https://user-images.githubusercontent.com/38145742/38648122-5b92778e-3df8-11e8-82ea-2eadfcd8764a.png)
diff --git a/src/drivers/ps2/browser.c b/src/drivers/ps2/browser.c
index c170297..3ffdbdf 100644
--- a/src/drivers/ps2/browser.c
+++ b/src/drivers/ps2/browser.c
@@ -46,7 +46,7 @@ char mpartitions[4][256];
u16 history[20]; //20 levels should be enough
u8 h = 0;
-extern int Browser_Menu(void);
+extern int Browser_Menu();
static inline char* strzncpy(char *d, char *s, int l) { d[0] = 0; return strncat(d, s, l); }
@@ -624,7 +624,7 @@ char* Browser(int files_too, int menu_id)
if(selection != oldselect) {
gsKit_clear(gsGlobal,GS_SETREG_RGBAQ(0x00,0x00,0x00,0x80,0x00));
- browser_primitive("FCEUltra PS2 B0.93 [x.2.0]","Browser", &BG_TEX, menu_x1, menu_y1, menu_x2, menu_y2);
+ browser_primitive("FCEUltra PS2 B0.93 [x.2.1]","Browser", &BG_TEX, menu_x1, menu_y1, menu_x2, menu_y2);
if(selection > max_item) {
list_offset = text_line - (selection - max_item) * FONT_HEIGHT;
diff --git a/src/drivers/ps2/cnfsettings.c b/src/drivers/ps2/cnfsettings.c
index 8ca9b70..8c22f62 100644
--- a/src/drivers/ps2/cnfsettings.c
+++ b/src/drivers/ps2/cnfsettings.c
@@ -583,7 +583,7 @@ void Save_Global_CNF(char *CNF_path_p)
} // Ends Save_Global_CNF
-void Default_Global_CNF(void)
+void Default_Global_CNF()
{
Settings.input_4p_adaptor = 0;
Settings.current_palette = 1;
@@ -623,7 +623,7 @@ void Default_Global_CNF(void)
Settings.PlayerInput[0][4] = PAD_R3;
}
-void Default_Skin_CNF(void)
+void Default_Skin_CNF()
{
FCEUSkin.frame = GS_SETREG_RGBAQ(0xFF,0xFF,0xFF,0x80,0x00);
FCEUSkin.textcolor = GS_SETREG_RGBAQ(0xFF,0xFF,0xFF,0x80,0x00);
diff --git a/src/drivers/ps2/init.c b/src/drivers/ps2/init.c
index 8ac2673..d92e8bd 100644
--- a/src/drivers/ps2/init.c
+++ b/src/drivers/ps2/init.c
@@ -77,7 +77,7 @@ void poweroffps2(int i)
poweroffShutdown();
}
-void SetupGSKit(void)
+void SetupGSKit()
{
/* detect and set screentype */
//gsGlobal = gsKit_init_global(GS_MODE_PAL);
@@ -107,7 +107,7 @@ void SetupGSKit(void)
}
-void InitPS2(void)
+void InitPS2()
{
int i, sometime;
static char hddarg[] = "-o" "\0" "4" "\0" "-n" "\0" "20";
@@ -174,7 +174,7 @@ printf("Failed to load module: cdInit2\n");
mtapPortOpen(0);
}
-void normalize_screen(void)
+void normalize_screen()
{
GS_SET_DISPLAY1(gsGlobal->StartX, // X position in the display area (in VCK unit
gsGlobal->StartY, // Y position in the display area (in Raster u
@@ -191,7 +191,7 @@ void normalize_screen(void)
gsGlobal->DH - 1); // Display area height
}
-void init_custom_screen(void)
+void init_custom_screen()
{
//init real non-interlaced mode
if(Settings.display) {
diff --git a/src/drivers/ps2/main.c b/src/drivers/ps2/main.c
index 5c53405..436ed29 100644
--- a/src/drivers/ps2/main.c
+++ b/src/drivers/ps2/main.c
@@ -20,8 +20,8 @@ int FONT_HEIGHT = 16;
#ifdef SOUND_ON
#include
#endif
-FCEUGI *CurGame=NULL;
-const char * GetKeyboard(void) {
+FCEUGI *CurGame = NULL;
+const char * GetKeyboard() {
return "";
}
int PPUViewScanline = 0;
@@ -36,6 +36,7 @@ struct st_palettes {
};
struct st_palettes palettes[] = {
+ { "", "Default (FCEU)", { 0 } },
{ "asqrealc", "AspiringSquire's Real palette",
{ 0x6c6c6c, 0x00268e, 0x0000a8, 0x400094,
0x700070, 0x780040, 0x700000, 0x621600,
@@ -53,6 +54,261 @@ struct st_palettes palettes[] = {
0x1cc2ea, 0x585858, 0x101010, 0x101010,
0xffe890, 0xf0f4a4, 0xc0ffc0, 0xacf4f0,
0xa0e8ff, 0xc2c2c2, 0x202020, 0x101010 } },
+ { "nintendo-vc", "Virtual Console palette",
+ { 0x494949, 0x00006a, 0x090063, 0x290059,
+ 0x42004a, 0x490000, 0x420000, 0x291100,
+ 0x747174, 0x003084, 0x3101ac, 0x4b0194,
+ 0x64007b, 0x6b0039, 0x6b2101, 0x5a2f00,
+ 0x182700, 0x003010, 0x003000, 0x002910,
+ 0x012043, 0x000000, 0x000000, 0x000000,
+ 0x424900, 0x185901, 0x105901, 0x015932,
+ 0x01495a, 0x101010, 0x000000, 0x000000,
+ 0xadadad, 0x4a71b6, 0x6458d5, 0x8450e6,
+ 0xa451ad, 0xad4984, 0xb5624a, 0x947132,
+ 0xb6b6b6, 0x8c9db5, 0x8d8eae, 0x9c8ebc,
+ 0xa687bc, 0xad8d9d, 0xae968c, 0x9c8f7c,
+ 0x7b722a, 0x5a8601, 0x388e31, 0x318e5a,
+ 0x398e8d, 0x383838, 0x000000, 0x000000,
+ 0x9c9e72, 0x94a67c, 0x84a77b, 0x7c9d84,
+ 0x73968d, 0xdedede, 0x000000, 0x000000 } },
+ { "rgb", "Nintendo RGB PPU palette",
+ { 0x6D6D6D, 0x002492, 0x0000DB, 0x6D49DB,
+ 0x92006D, 0xB6006D, 0xB62400, 0x924900,
+ 0xB6B6B6, 0x006DDB, 0x0049FF, 0x9200FF,
+ 0xB600FF, 0xFF0092, 0xFF0000, 0xDB6D00,
+ 0x6D4900, 0x244900, 0x006D24, 0x009200,
+ 0x004949, 0x000000, 0x000000, 0x000000,
+ 0x926D00, 0x249200, 0x009200, 0x00B66D,
+ 0x009292, 0x242424, 0x000000, 0x000000,
+ 0xFFFFFF, 0x6DB6FF, 0x9292FF, 0xDB6DFF,
+ 0xFF00FF, 0xFF6DFF, 0xFF9200, 0xFFB600,
+ 0xFFFFFF, 0xB6DBFF, 0xDBB6FF, 0xFFB6FF,
+ 0xFF92FF, 0xFFB6B6, 0xFFDB92, 0xFFFF49,
+ 0xDBDB00, 0x6DDB00, 0x00FF00, 0x49FFDB,
+ 0x00FFFF, 0x494949, 0x000000, 0x000000,
+ 0xFFFF6D, 0xB6FF49, 0x92FF6D, 0x49FFDB,
+ 0x92DBFF, 0x929292, 0x000000, 0x000000 } },
+ { "yuv-v3", "FBX's YUV-V3 palette",
+ { 0x666666, 0x002A88, 0x1412A7, 0x3B00A4,
+ 0x5C007E, 0x6E0040, 0x6C0700, 0x561D00,
+ 0xADADAD, 0x155FD9, 0x4240FF, 0x7527FE,
+ 0xA01ACC, 0xB71E7B, 0xB53120, 0x994E00,
+ 0x333500, 0x0C4800, 0x005200, 0x004C18,
+ 0x003E5B, 0x000000, 0x000000, 0x000000,
+ 0x6B6D00, 0x388700, 0x0D9300, 0x008C47,
+ 0x007AA0, 0x000000, 0x000000, 0x000000,
+ 0xFFFFFF, 0x64B0FF, 0x9290FF, 0xC676FF,
+ 0xF26AFF, 0xFF6ECC, 0xFF8170, 0xEA9E22,
+ 0xFFFFFF, 0xC0DFFF, 0xD3D2FF, 0xE8C8FF,
+ 0xFAC2FF, 0xFFC4EA, 0xFFCCC5, 0xF7D8A5,
+ 0xBCBE00, 0x88D800, 0x5CE430, 0x45E082,
+ 0x48CDDE, 0x4F4F4F, 0x000000, 0x000000,
+ 0xE4E594, 0xCFEF96, 0xBDF4AB, 0xB3F3CC,
+ 0xB5EBF2, 0xB8B8B8, 0x000000, 0x000000 } },
+ { "unsaturated-final", "FBX's Unsaturated-Final palette",
+ { 0x676767, 0x001F8E, 0x23069E, 0x40008E,
+ 0x600067, 0x67001C, 0x5B1000, 0x432500,
+ 0xB3B3B3, 0x205ADF, 0x5138FB, 0x7A27EE,
+ 0xA520C2, 0xB0226B, 0xAD3702, 0x8D5600,
+ 0x313400, 0x074800, 0x004F00, 0x004622,
+ 0x003A61, 0x000000, 0x000000, 0x000000,
+ 0x6E7000, 0x2E8A00, 0x069200, 0x008A47,
+ 0x037B9B, 0x101010, 0x000000, 0x000000,
+ 0xFFFFFF, 0x62AEFF, 0x918BFF, 0xBC78FF,
+ 0xE96EFF, 0xFC6CCD, 0xFA8267, 0xE29B26,
+ 0xFFFFFF, 0xC1E3FF, 0xD5D4FF, 0xE7CCFF,
+ 0xFBC9FF, 0xFFC7F0, 0xFFD0C5, 0xF8DAAA,
+ 0xC0B901, 0x84D200, 0x58DE38, 0x46D97D,
+ 0x49CED2, 0x494949, 0x000000, 0x000000,
+ 0xEBE69A, 0xD1F19A, 0xBEF7AF, 0xB6F4CD,
+ 0xB7F0EF, 0xB2B2B2, 0x000000, 0x000000 } },
+ { "sony-cxa2025as-us", "Sony CXA2025AS US palette",
+ { 0x585858, 0x00238C, 0x00139B, 0x2D0585,
+ 0x5D0052, 0x7A0017, 0x7A0800, 0x5F1800,
+ 0xA1A1A1, 0x0053EE, 0x153CFE, 0x6028E4,
+ 0xA91D98, 0xD41E41, 0xD22C00, 0xAA4400,
+ 0x352A00, 0x093900, 0x003F00, 0x003C22,
+ 0x00325D, 0x000000, 0x000000, 0x000000,
+ 0x6C5E00, 0x2D7300, 0x007D06, 0x007852,
+ 0x0069A9, 0x000000, 0x000000, 0x000000,
+ 0xFFFFFF, 0x1FA5FE, 0x5E89FE, 0xB572FE,
+ 0xFE65F6, 0xFE6790, 0xFE773C, 0xFE9308,
+ 0xFFFFFF, 0xA0D9FE, 0xBDCCFE, 0xE1C2FE,
+ 0xFEBCFB, 0xFEBDD0, 0xFEC5A9, 0xFED18E,
+ 0xC4B200, 0x79CA10, 0x3AD54A, 0x11D1A4,
+ 0x06BFFE, 0x424242, 0x000000, 0x000000,
+ 0xE9DE86, 0xC7E992, 0xA8EEB0, 0x95ECD9,
+ 0x91E4FE, 0xACACAC, 0x000000, 0x000000 } },
+ { "pal", "PAL palette",
+ { 0x808080, 0x0000BA, 0x3700BF, 0x8400A6,
+ 0xBB006A, 0xB7001E, 0xB30000, 0x912600,
+ 0xC8C8C8, 0x0059FF, 0x443CFF, 0xB733CC,
+ 0xFE33AA, 0xFE375E, 0xFE371A, 0xD54B00,
+ 0x7B2B00, 0x003E00, 0x00480D, 0x003C22,
+ 0x002F66, 0x000000, 0x050505, 0x050505,
+ 0xC46200, 0x3C7B00, 0x1D8415, 0x009566,
+ 0x0084C4, 0x111111, 0x090909, 0x090909,
+ 0xFEFEFE, 0x0095FF, 0x6F84FF, 0xD56FFF,
+ 0xFE77CC, 0xFE6F99, 0xFE7B59, 0xFE915F,
+ 0xFEFEFE, 0x84BFFF, 0xBBBBFF, 0xD0BBFF,
+ 0xFEBFEA, 0xFEBFCC, 0xFEC4B7, 0xFECCAE,
+ 0xFEA233, 0xA6BF00, 0x51D96A, 0x4DD5AE,
+ 0x00D9FF, 0x666666, 0x0D0D0D, 0x0D0D0D,
+ 0xFED9A2, 0xCCE199, 0xAEEEB7, 0xAAF8EE,
+ 0xB3EEFF, 0xDDDDDD, 0x111111, 0x111111 } },
+ { "bmf-final2", "BMF's Final 2 palette",
+ { 0x525252, 0x000080, 0x08008A, 0x2C007E,
+ 0x4A004E, 0x500006, 0x440000, 0x260800,
+ 0xA4A4A4, 0x0038CE, 0x3416EC, 0x5E04DC,
+ 0x8C00B0, 0x9A004C, 0x901800, 0x703600,
+ 0x0A2000, 0x002E00, 0x003200, 0x00260A,
+ 0x001C48, 0x000000, 0x000000, 0x000000,
+ 0x4C5400, 0x0E6C00, 0x007400, 0x006C2C,
+ 0x005E84, 0x000000, 0x000000, 0x000000,
+ 0xFFFFFF, 0x4C9CFF, 0x7C78FF, 0xA664FF,
+ 0xDA5AFF, 0xF054C0, 0xF06A56, 0xD68610,
+ 0xFFFFFF, 0xB6DAFF, 0xC8CAFF, 0xDAC2FF,
+ 0xF0BEFF, 0xFCBCEE, 0xFAC2C0, 0xF2CCA2,
+ 0xBAA400, 0x76C000, 0x46CC1A, 0x2EC866,
+ 0x34C2BE, 0x3A3A3A, 0x000000, 0x000000,
+ 0xE6DA92, 0xCCE68E, 0xB8EEA2, 0xAEEABE,
+ 0xAEE8E2, 0xB0B0B0, 0x000000, 0x000000 } },
+ { "bmf-final3", "BMF's Final 3 palette",
+ { 0x686868, 0x001299, 0x1A08AA, 0x51029A,
+ 0x7E0069, 0x8E001C, 0x7E0301, 0x511800,
+ 0xB9B9B9, 0x0C5CD7, 0x5035F0, 0x8919E0,
+ 0xBB0CB3, 0xCE0C61, 0xC02B0E, 0x954D01,
+ 0x1F3700, 0x014E00, 0x005A00, 0x00501C,
+ 0x004061, 0x000000, 0x000000, 0x000000,
+ 0x616F00, 0x1F8B00, 0x01980C, 0x00934B,
+ 0x00819B, 0x000000, 0x000000, 0x000000,
+ 0xFFFFFF, 0x63B4FF, 0x9B91FF, 0xD377FF,
+ 0xEF6AFF, 0xF968C0, 0xF97D6C, 0xED9B2D,
+ 0xFFFFFF, 0xACE7FF, 0xD5CDFF, 0xEDBAFF,
+ 0xF8B0FF, 0xFEB0EC, 0xFDBDB5, 0xF9D28E,
+ 0xBDBD16, 0x7CDA1C, 0x4BE847, 0x35E591,
+ 0x3FD9DD, 0x606060, 0x000000, 0x000000,
+ 0xE8EB7C, 0xBBF382, 0x99F7A2, 0x8AF5D0,
+ 0x92F4F1, 0xBEBEBE, 0x000000, 0x000000 } },
+ { "smooth-fbx", "FBX's Smooth palette",
+ { 0x6A6D6A, 0x001380, 0x1E008A, 0x39007A,
+ 0x550056, 0x5A0018, 0x4F1000, 0x3D1C00,
+ 0xB9BCB9, 0x1850C7, 0x4B30E3, 0x7322D6,
+ 0x951FA9, 0x9D285C, 0x983700, 0x7F4C00,
+ 0x253200, 0x003D00, 0x004000, 0x003924,
+ 0x002E55, 0x000000, 0x000000, 0x000000,
+ 0x5E6400, 0x227700, 0x027E02, 0x007645,
+ 0x006E8A, 0x000000, 0x000000, 0x000000,
+ 0xFFFFFF, 0x68A6FF, 0x8C9CFF, 0xB586FF,
+ 0xD975FD, 0xE377B9, 0xE58D68, 0xD49D29,
+ 0xFFFFFF, 0xCCEAFF, 0xDDDEFF, 0xECDAFF,
+ 0xF8D7FE, 0xFCD6F5, 0xFDDBCF, 0xF9E7B5,
+ 0xB3AF0C, 0x7BC211, 0x55CA47, 0x46CB81,
+ 0x47C1C5, 0x4A4D4A, 0x000000, 0x000000,
+ 0xF1F0AA, 0xDAFAA9, 0xC9FFBC, 0xC3FBD7,
+ 0xC4F6F6, 0xBEC1BE, 0x000000, 0x000000 } },
+ { "composite-direct-fbx", "FBX's Composite Direct palette",
+ { 0x656565, 0x00127D, 0x18008E, 0x360082,
+ 0x56005D, 0x5A0018, 0x4F0500, 0x381900,
+ 0xAFAFAF, 0x194EC8, 0x472FE3, 0x6B1FD7,
+ 0x931BAE, 0x9E1A5E, 0x993200, 0x7B4B00,
+ 0x1D3100, 0x003D00, 0x004100, 0x003B17,
+ 0x002E55, 0x000000, 0x000000, 0x000000,
+ 0x5B6700, 0x267A00, 0x008200, 0x007A3E,
+ 0x006E8A, 0x000000, 0x000000, 0x000000,
+ 0xFFFFFF, 0x64A9FF, 0x8E89FF, 0xB676FF,
+ 0xE06FFF, 0xEF6CC4, 0xF0806A, 0xD8982C,
+ 0xFFFFFF, 0xC7E5FF, 0xD9D9FF, 0xE9D1FF,
+ 0xF9CEFF, 0xFFCCF1, 0xFFD4CB, 0xF8DFB1,
+ 0xB9B40A, 0x83CB0C, 0x5BD63F, 0x4AD17E,
+ 0x4DC7CB, 0x4C4C4C, 0x000000, 0x000000,
+ 0xEDEAA4, 0xD6F4A4, 0xC5F8B8, 0xBEF6D3,
+ 0xBFF1F1, 0xB9B9B9, 0x000000, 0x000000 } },
+ { "pvm-style-d93-fbx", "FBX's PVM Style D93 palette",
+ { 0x696B63, 0x001774, 0x1E0087, 0x340073,
+ 0x560057, 0x5E0013, 0x531A00, 0x3B2400,
+ 0xB9BBB3, 0x1453B9, 0x4D2CDA, 0x671EDE,
+ 0x98189C, 0x9D2344, 0xA03E00, 0x8D5500,
+ 0x243000, 0x063A00, 0x003F00, 0x003B1E,
+ 0x00334E, 0x000000, 0x000000, 0x000000,
+ 0x656D00, 0x2C7900, 0x008100, 0x007D42,
+ 0x00788A, 0x000000, 0x000000, 0x000000,
+ 0xFFFFFF, 0x69A8FF, 0x9691FF, 0xB28AFA,
+ 0xEA7DFA, 0xF37BC7, 0xF28E59, 0xE6AD27,
+ 0xFFFFFF, 0xD2EAFF, 0xE2E2FF, 0xE9D8FF,
+ 0xF5D2FF, 0xF8D9EA, 0xFADEB9, 0xF9E89B,
+ 0xD7C805, 0x90DF07, 0x64E53C, 0x45E27D,
+ 0x48D5D9, 0x4E5048, 0x000000, 0x000000,
+ 0xF3F28C, 0xD3FA91, 0xB8FCA8, 0xAEFACA,
+ 0xCAF3F3, 0xBEC0B8, 0x000000, 0x000000 } },
+ { "ntsc-hardware-fbx", "FBX's NTSC Hardware palette",
+ { 0x6A6D6A, 0x001380, 0x1E008A, 0x39007A,
+ 0x550056, 0x5A0018, 0x4F1000, 0x382100,
+ 0xB9BCB9, 0x1850C7, 0x4B30E3, 0x7322D6,
+ 0x951FA9, 0x9D285C, 0x963C00, 0x7A5100,
+ 0x213300, 0x003D00, 0x004000, 0x003924,
+ 0x002E55, 0x000000, 0x000000, 0x000000,
+ 0x5B6700, 0x227700, 0x027E02, 0x007645,
+ 0x006E8A, 0x000000, 0x000000, 0x000000,
+ 0xFFFFFF, 0x68A6FF, 0x9299FF, 0xB085FF,
+ 0xD975FD, 0xE377B9, 0xE58D68, 0xCFA22C,
+ 0xFFFFFF, 0xCCEAFF, 0xDDDEFF, 0xECDAFF,
+ 0xF8D7FE, 0xFCD6F5, 0xFDDBCF, 0xF9E7B5,
+ 0xB3AF0C, 0x7BC211, 0x55CA47, 0x46CB81,
+ 0x47C1C5, 0x4A4D4A, 0x000000, 0x000000,
+ 0xF1F0AA, 0xDAFAA9, 0xC9FFBC, 0xC3FBD7,
+ 0xC4F6F6, 0xBEC1BE, 0x000000, 0x000000 } },
+ { "nes-classic-fbx-fs", "FBX's NES-Classic FS palette",
+ { 0x60615F, 0x000083, 0x1D0195, 0x340875,
+ 0x51055E, 0x56000F, 0x4C0700, 0x372308,
+ 0xA9AAA8, 0x104BBF, 0x4712D8, 0x6300CA,
+ 0x8800A9, 0x930B46, 0x8A2D04, 0x6F5206,
+ 0x203A0B, 0x0F4B0E, 0x194C16, 0x02421E,
+ 0x023154, 0x000000, 0x000000, 0x000000,
+ 0x5C7114, 0x1B8D12, 0x199509, 0x178448,
+ 0x206B8E, 0x000000, 0x000000, 0x000000,
+ 0xFBFBFB, 0x6699F8, 0x8974F9, 0xAB58F8,
+ 0xD557EF, 0xDE5FA9, 0xDC7F59, 0xC7A224,
+ 0xFBFBFB, 0xBED4FA, 0xC9C7F9, 0xD7BEFA,
+ 0xE8B8F9, 0xF5BAE5, 0xF3CAC2, 0xDFCDA7,
+ 0xA7BE03, 0x75D703, 0x60E34F, 0x3CD68D,
+ 0x56C9CC, 0x414240, 0x000000, 0x000000,
+ 0xD9E09C, 0xC9EB9E, 0xC0EDB8, 0xB5F4C7,
+ 0xB9EAE9, 0xABABAB, 0x000000, 0x000000 } },
+ { "nescap", "RGBSource's NESCAP palette",
+ { 0x646365, 0x001580, 0x1D0090, 0x380082,
+ 0x56005D, 0x5A001A, 0x4F0900, 0x381B00,
+ 0xAFADAF, 0x164BCA, 0x472AE7, 0x6B1BDB,
+ 0x9617B0, 0x9F185B, 0x963001, 0x7B4800,
+ 0x1E3100, 0x003D00, 0x004100, 0x003A1B,
+ 0x002F55, 0x000000, 0x000000, 0x000000,
+ 0x5A6600, 0x237800, 0x017F00, 0x00783D,
+ 0x006C8C, 0x000000, 0x000000, 0x000000,
+ 0xFFFFFF, 0x60A6FF, 0x8F84FF, 0xB473FF,
+ 0xE26CFF, 0xF268C3, 0xEF7E61, 0xD89527,
+ 0xFFFFFF, 0xC2E0FF, 0xD5D2FF, 0xE3CBFF,
+ 0xF7C8FF, 0xFEC6EE, 0xFECEC6, 0xF6D7AE,
+ 0xBAB307, 0x81C807, 0x57D43D, 0x47CF7E,
+ 0x4BC5CD, 0x4C4B4D, 0x000000, 0x000000,
+ 0xE9E49F, 0xD3ED9D, 0xC0F2B2, 0xB9F1CC,
+ 0xBAEDED, 0xBAB9BB, 0x000000, 0x000000 } },
+ { "wavebeam", "nakedarthur's Wavebeam palette",
+ { 0X6B6B6B, 0X001B88, 0X21009A, 0X40008C,
+ 0X600067, 0X64001E, 0X590800, 0X481600,
+ 0XB4B4B4, 0X1555D3, 0X4337EF, 0X7425DF,
+ 0X9C19B9, 0XAC0F64, 0XAA2C00, 0X8A4B00,
+ 0X283600, 0X004500, 0X004908, 0X00421D,
+ 0X003659, 0X000000, 0X000000, 0X000000,
+ 0X666B00, 0X218300, 0X008A00, 0X008144,
+ 0X007691, 0X000000, 0X000000, 0X000000,
+ 0XFFFFFF, 0X63B2FF, 0X7C9CFF, 0XC07DFE,
+ 0XE977FF, 0XF572CD, 0XF4886B, 0XDDA029,
+ 0XFFFFFF, 0XBCDFFF, 0XD2D2FF, 0XE1C8FF,
+ 0XEFC7FF, 0XFFC3E1, 0XFFCAC6, 0XF2DAAD,
+ 0XBDBD0A, 0X89D20E, 0X5CDE3E, 0X4BD886,
+ 0X4DCFD2, 0X525252, 0X000000, 0X000000,
+ 0XEBE3A0, 0XD2EDA2, 0XBCF4B4, 0XB5F1CE,
+ 0XB6ECF1, 0XBFBFBF, 0X000000, 0X000000 } },
{ "loopy", "Loopy's palette",
{ 0x757575, 0x271b8f, 0x0000ab, 0x47009f,
0x8f0077, 0xab0013, 0xa70000, 0x7f0b00,
@@ -284,7 +540,7 @@ u32 NesPalette[ 64 ] =
0xffffff, 0xabe7ff, 0xc7d7ff, 0xd7cbff, 0xffc7ff, 0xffc7db, 0xffbfb3, 0xffdbab,
0xffe7a3, 0xe3ffa3, 0xabf3bf, 0xb3ffcf, 0x9ffff3, 0x000000, 0x000000, 0x000000
};
-u32 NesPalette[ 64 ] = //modified palette for GS
+u32 NesPalette[ 64 ] = // Modified palette for GS
{
0x757575, 0x271b8f, 0x0000ab, 0x47009f, 0x8f0077, 0xab0013, 0xa70000, 0x7f0b00, //1 start
0xbcbcbc, 0x0073ef, 0x233bef, 0x8300f3, 0xbf00bf, 0xe7005b, 0xdb2b00, 0xcb4f0f, //2 start
@@ -295,9 +551,7 @@ u32 NesPalette[ 64 ] = //modified palette for GS
0xf3bf3f, 0x83d313, 0x4fdf4b, 0x58f898, 0x00ebdb, 0x000000, 0x000000, 0x000000, //3 finish
0xffe7a3, 0xe3ffa3, 0xabf3bf, 0xb3ffcf, 0x9ffff3, 0x000000, 0x000000, 0x000000 //4 finish
};
-
-
-u32 NesPalette[64] = //"AspiringSquire's NES Palette
+u32 NesPalette[64] = // "AspiringSquire's NES Palette
{
0x6c6c6c, 0x00268e, 0x0000a8, 0x400090, 0x700070, 0x780040, 0x700000, 0x621600,
0xbababa, 0x205cdc, 0x3838ff, 0x8020f0, 0xc000c0, 0xd01474, 0xd02020, 0xac4014,
@@ -313,11 +567,21 @@ u32 NesPalette[64] = //"AspiringSquire's NES Palette
/* Prototypes */
/************************************/
extern void Set_NESInput();
-extern int Get_NESInput();
-static int PS2_LoadGame(char *path);
-void SetupNESTexture();
-void SetupNESGS();
+extern int Get_NESInput();
+
+static int PS2_LoadGame(char *path);
+static void SetupNESTexture();
+ void SetupNESClut();
+ void SetupNESGS();
static void DoFun();
+/***********************************/
+/* Sound */
+/***********************************/
+#define SAMPLERATES_SIZE 4
+static int SND_sampleRates[SAMPLERATES_SIZE] = { 0, 11025, 22050, 44100 };
+static void SND_Init();
+ void SND_SetNextSampleRate();
+ int SND_GetCurrSampleRate();
int main(int argc, char *argv[])
{
@@ -423,10 +687,10 @@ int main(int argc, char *argv[])
ImgData = 0;
if (strstr(FCEUSkin.bgMenu,".png") != NULL) {
- if (gsKit_texture_png(gsGlobal, &MENU_TEX, FCEUSkin.bgMenu) == -1) {
+ if (gsKit_texture_png(gsGlobal, &MENU_TEX, FCEUSkin.bgMenu) == -1) {
printf("Error with menu background png!\n");
menutex = 1;
- }
+ }
}
else if (strstr(FCEUSkin.bgMenu,".jpg") || strstr(FCEUSkin.bgMenu,".jpeg") != NULL) {
//if (gsKit_texture_jpeg(gsGlobal, &MENU_TEX, FCEUSkin.bgMenu) < 0) { // Apparently didn't like the "myps2" libjpg
@@ -469,40 +733,21 @@ int main(int argc, char *argv[])
// FCEUI_SetRenderedLines(8, 231, 0, 239);
// FCEUI_GetCurrentVidSystem(&srendline, &erendline);
// totallines = erendline - srendline + 1;
-#ifdef SOUND_ON
- FCEUI_SetSoundVolume(1024);
-#else
- FCEUI_SetSoundVolume(0);
-#endif
- FCEUI_SetSoundQuality(0);
- FCEUI_SetLowPass(0); // Not used if Quality = 0
- if (Settings.sound) {
- FCEUI_Sound(SAMPLERATE);
- }
- else {
- FCEUI_Sound(0);
- }
-#ifdef SOUND_ON
- struct audsrv_fmt_t format;
- format.bits = 16;
- format.freq = SAMPLERATE;
- format.channels = 1;
- audsrv_set_format(&format);
- audsrv_set_volume(MAX_VOLUME);
-#endif
+ SND_Init();
SetupNESTexture();
// Main emulation loop
for (;;) {
- strcpy((char *)path, Browser(1,0));
+ strcpy((char *)path, Browser(1, 0));
if (PS2_LoadGame((char *)path) == 0) {
continue;
}
Set_NESInput();
+ SetupNESClut();
SetupNESGS();
while (CurGame) // FCEUI_CloseGame turns this false
@@ -537,8 +782,6 @@ static int PS2_LoadGame(char *path)
void SetupNESTexture()
{
- int i, r, g, b;
-
// Comments after settings are for regular clut lookup
//Setup NES_TEX Texture
NES_TEX.PSM = GS_PSM_T8; //GS_PSM_CT32
@@ -550,23 +793,43 @@ void SetupNESTexture()
NES_TEX.TBW = 4;
//NES_TEX.Mem = memalign(128, gsKit_texture_size_ee(NES_TEX.Width, NES_TEX.Height, NES_TEX.PSM));
NES_TEX.Vram = gsKit_vram_alloc(gsGlobal, gsKit_texture_size(NES_TEX.Width, NES_TEX.Height, NES_TEX.PSM), GSKIT_ALLOC_USERBUFFER);
+}
- // Setup NES Clut
- for (i = 0; i< 64; i++)
- {
- // 32-bit bgr -< rgb
- r = (palettes[Settings.current_palette - 1].data[i] & 0xff0000) >> 16;
- g = (palettes[Settings.current_palette - 1].data[i] & 0xff00) >> 8;
- b = (palettes[Settings.current_palette - 1].data[i] & 0xff) >> 0;
- NES_TEX.Clut[i + 0] = ((b<<16)|(g<<8)|(r<<0)); //NES_TEX.Clut = ps2palette;
- NES_TEX.Clut[i + 64] = ((b<<16)|(g<<8)|(r<<0));
- NES_TEX.Clut[i + 128] = ((b<<16)|(g<<8)|(r<<0));
- NES_TEX.Clut[i + 192] = ((b<<16)|(g<<8)|(r<<0));
+void SetupNESClut()
+{
+ int i, r, g, b;
+ if (Settings.current_palette - 1 == 0 || CurGame->type == GIT_VSUNI) {
+ uint8 r, g, b;
+ for (i = 0; i < 256; i++) {
+ FCEUD_GetPalette(i, &r, &g, &b);
+ NES_TEX.Clut[i] = ((b<<16)|(g<<8)|(r<<0));
+ }
+ // Modification for GS
+ for (i = 0; i < 256; i++) {
+ int modi = i & 63;
+ if ((modi >= 8 && modi < 16) || (modi >= 40 && modi < 48)) {
+ u32 tmp;
+ tmp = NES_TEX.Clut[i];
+ NES_TEX.Clut[i] = NES_TEX.Clut[i + 8];
+ NES_TEX.Clut[i + 8] = tmp;
+ }
+ }
+ }
+ else {
+ for (i = 0; i < 64; i++) {
+ // 32-bit bgr -< rgb
+ r = (palettes[Settings.current_palette - 1].data[i] & 0xff0000) >> 16;
+ g = (palettes[Settings.current_palette - 1].data[i] & 0xff00) >> 8;
+ b = (palettes[Settings.current_palette - 1].data[i] & 0xff) >> 0;
+ NES_TEX.Clut[i + 0] = ((b<<16)|(g<<8)|(r<<0)); //NES_TEX.Clut = ps2palette;
+ NES_TEX.Clut[i + 64] = ((b<<16)|(g<<8)|(r<<0));
+ NES_TEX.Clut[i + 128] = ((b<<16)|(g<<8)|(r<<0));
+ NES_TEX.Clut[i + 192] = ((b<<16)|(g<<8)|(r<<0));
+ }
}
-
}
-void SetupNESGS(void)
+void SetupNESGS()
{
uint8 r, g, b;
int v1, v2, y1, y2;
@@ -597,7 +860,8 @@ void SetupNESGS(void)
v1 = 8;
v2 = (NES_TEX.Height - 16) + 8;
y2 = (NES_TEX.Height - 16);
- } else {
+ }
+ else {
v1 = 0;
v2 = NES_TEX.Height;
y2 = NES_TEX.Height;
@@ -698,3 +962,44 @@ static void DoFun()
FCEUI_Emulate(&gfx, &sound, &ssize, 0);
FCEUD_Update(gfx, sound, ssize);
}
+
+static void SND_Init()
+{
+#ifdef SOUND_ON
+ FCEUI_SetSoundVolume(1024);
+#else
+ FCEUI_SetSoundVolume(0);
+#endif
+ FCEUI_SetSoundQuality(0);
+ FCEUI_SetLowPass(0);
+
+ if (Settings.sound >= SAMPLERATES_SIZE) {
+ Settings.sound = 0;
+ }
+#ifndef SOUND_ON
+ Settings.sound = 0;
+#endif
+ FCEUI_Sound(SND_sampleRates[Settings.sound]);
+
+#ifdef SOUND_ON
+ struct audsrv_fmt_t format;
+ format.bits = 16;
+ format.freq = SND_sampleRates[Settings.sound];
+ format.channels = 1;
+ audsrv_set_format(&format);
+ audsrv_set_volume(MAX_VOLUME);
+#endif
+}
+
+void SND_SetNextSampleRate()
+{
+#ifdef SOUND_ON
+ Settings.sound++;
+ SND_Init();
+#endif
+}
+
+int SND_GetCurrSampleRate()
+{
+ return SND_sampleRates[Settings.sound];
+}
diff --git a/src/drivers/ps2/menu.c b/src/drivers/ps2/menu.c
index cc827a7..c41419a 100644
--- a/src/drivers/ps2/menu.c
+++ b/src/drivers/ps2/menu.c
@@ -31,26 +31,13 @@ extern char partitions[4][256];
extern u8 h;
// Palette for FCEU
-#define MAXPAL 13
-struct st_palette_names {
+#define MAXPAL 29
+struct st_palettes {
char name[32];
+ char desc[32];
+ unsigned int data[64];
};
-
-struct st_palette_names palette_names[] = {
- {"AspiringSquire's Real"},
- {"Loopy's"},
- {"Quor's"},
- {"Chris Covell's"},
- {"Matthew Conte's"},
- {"PasoFami/99"},
- {"CrashMan's"},
- {"MESS"},
- {"Zaphod's VS Castlevania"},
- {"Zaphod's VS SMB"},
- {"VS Dr. Mario"},
- {"VS Castlevania"},
- {"VS SMB/VS Ice Climber"}
-};
+extern struct st_palettes palettes[];
int statenum = 0;
u8 power_off = 0;
@@ -247,7 +234,7 @@ int menu_input(int port, int center_screen)
Exit to Elf Path
Exit to PS2Browser
**/
-int Browser_Menu(void)
+int Browser_Menu()
{
char cnfpath[2048];
int i,selection = 0;
@@ -522,10 +509,13 @@ int Browser_Menu(void)
Set Input "DisplayName" (pushing left or right here cycles though 0-9, which parses the control(number).cnf)
Exit Game (Saves Sram)
**/
-extern void SetupNESGS(void);
-extern void SetupNESTexture(void);
+extern void SetupNESGS();
+extern void SetupNESClut();
+
+extern void SND_SetNextSampleRate();
+extern int SND_GetCurrSampleRate();
-void Ingame_Menu(void)
+void Ingame_Menu()
{
int i, selection = 0;
oldselect = -1;
@@ -571,9 +561,9 @@ void Ingame_Menu(void)
break;
case 4:
if (!Settings.sound)
- strcpy(options_state[i], "Off (faster)");
+ strcpy(options_state[i], "Off");
else
- strcpy(options_state[i], "22050Hz");
+ sprintf(options_state[i], "%dHz", SND_GetCurrSampleRate());
break;
case 5:
if (!Settings.input_4p_adaptor)
@@ -588,7 +578,7 @@ void Ingame_Menu(void)
case 8:
break;
case 13:
- strcpy(options_state[i], palette_names[Settings.current_palette - 1].name);
+ strcpy(options_state[i], palettes[Settings.current_palette - 1].desc);
break;
}
}
@@ -668,15 +658,11 @@ void Ingame_Menu(void)
option_changed = 1;
break;
case 4:
- Settings.sound ^= 1;
- if (Settings.sound) {
- FCEUI_Sound(SAMPLERATE);
- strcpy(options_state[i], "22050Hz");
- }
- else {
- FCEUI_Sound(0);
- strcpy(options_state[i], "Off (faster)");
- }
+ SND_SetNextSampleRate();
+ if (!Settings.sound)
+ strcpy(options_state[i], "Off");
+ else
+ sprintf(options_state[i], "%dHz", SND_GetCurrSampleRate());
option_changed = 1;
break;
case 5:
@@ -713,8 +699,8 @@ void Ingame_Menu(void)
case 13:
Settings.current_palette++;
if (Settings.current_palette > MAXPAL) { Settings.current_palette = 1; }
- strcpy(options_state[i], palette_names[Settings.current_palette - 1].name);
- SetupNESTexture();
+ strcpy(options_state[i], palettes[Settings.current_palette - 1].desc);
+ SetupNESClut();
option_changed = 1;
break;
}
diff --git a/src/drivers/ps2/ps2fceu.h b/src/drivers/ps2/ps2fceu.h
index 9fb2590..d13d262 100644
--- a/src/drivers/ps2/ps2fceu.h
+++ b/src/drivers/ps2/ps2fceu.h
@@ -3,12 +3,6 @@
#include
#include
-#ifdef SOUND_ON
- #define SAMPLERATE 22050
-#else
- #define SAMPLERATE 0
-#endif
-
typedef struct {
char displayname[64];
int dircheck;
@@ -44,11 +38,11 @@ typedef struct {
} skin;
// Initialization prototypes
-void SetupGSKit(void);
-void InitPS2(void);
-void normalize_screen(void);
-void init_custom_screen(void);
-void setupPS2Pad(void);
+void SetupGSKit();
+void InitPS2();
+void normalize_screen();
+void init_custom_screen();
+void setupPS2Pad();
void DrawScreen(GSGLOBAL *gsGlobal);
@@ -67,8 +61,8 @@ void browser_primitive(char *title1, char *title2, GSTEXTURE *gsTexture, float x
// Global
void Load_Global_CNF(char *CNF_path_p);
void Save_Global_CNF(char *CNF_path_p);
-void Default_Global_CNF(void);
+void Default_Global_CNF();
// Skin
void Load_Skin_CNF(char *CNF_path_p);
void Save_Skin_CNF(char *CNF_path_p);
-void Default_Skin_CNF(void);
+void Default_Skin_CNF();
diff --git a/src/drivers/ps2/ps2input.c b/src/drivers/ps2/ps2input.c
index 7ea9b6f..a7e3b60 100644
--- a/src/drivers/ps2/ps2input.c
+++ b/src/drivers/ps2/ps2input.c
@@ -27,7 +27,7 @@ u8 fdsswap = 0;
static int NESButtons;
static struct padButtonStatus buttons[4];
-extern void Ingame_Menu(void);
+extern void Ingame_Menu();
static void waitPadReady(int port, int slot)
{
@@ -190,16 +190,23 @@ static unsigned char Get_PS2Input(int mport)
FCEUI_LoadState(NULL);
}
if (new_pad[mport] == Settings.PlayerInput[mport][3]) { // FDS_Disk_Swap
- fdsswap ^= 1;
- if (fdsswap) {
- FCEUI_FDSEject();
+ if (GameInfo->type == GIT_FDS) {
+ fdsswap ^= 1;
+ if (fdsswap) {
+ FCEUI_FDSEject();
+ }
+ else {
+ FCEUI_FDSInsert(0);
+ }
}
- else {
- FCEUI_FDSInsert(0);
+ else if (GameInfo->type == GIT_VSUNI) {
+ FCEUI_VSUniCoin();
}
}
if (new_pad[mport] == Settings.PlayerInput[mport][4]) { // FDS_Side_Swap
- FCEUI_FDSSelect();
+ if (GameInfo->type == GIT_FDS) {
+ FCEUI_FDSSelect();
+ }
}
if (paddata[mport] & Settings.PlayerInput[mport][5]) {
P |= JOY_A;