diff --git a/data/pcsxr.ui b/data/pcsxr.ui index 0b1d94de..23b7d449 100644 --- a/data/pcsxr.ui +++ b/data/pcsxr.ui @@ -1,6 +1,7 @@ + - + @@ -22,6 +23,7 @@ center-on-parent dialog pcsxr + image-missing False @@ -101,7 +103,6 @@ True True 5 - True etched-in @@ -227,555 +228,6 @@ closbutton1 - - False - 5 - Cheat Search - False - True - center-on-parent - dialog - - - True - False - vertical - 2 - - - True - False - end - - - gtk-close - True - True - True - True - - - False - False - 0 - - - - - False - True - end - 0 - - - - - True - False - 0 - - - True - False - 5 - 5 - 5 - - - True - False - 5 - - - True - False - 3 - 4 - 5 - 5 - - - True - False - liststore2 - - - - 0 - - - - - 1 - 2 - 1 - 2 - - - - - - True - False - 0 - Search For: - - - - - True - False - 0 - Data Type: - - - 1 - 2 - - - - - True - False - 0 - Value: - - - 2 - 3 - - - - - True - False - Data Base: - - - 2 - 3 - 1 - 2 - - - - - True - False - liststore3 - - - - 0 - - - - - 1 - 2 - - - - - - True - True - False - False - - - 1 - 2 - 2 - 3 - - - - - - True - False - liststore4 - - - - 0 - - - - - 3 - 4 - 1 - 2 - - - - - - True - False - To: - - - 2 - 3 - 2 - 3 - - - - - - - - True - True - False - False - - - 3 - 4 - 2 - 3 - - - - - - - - False - True - 0 - - - - - True - False - - - 450 - 250 - True - True - never - etched-in - - - True - True - False - False - vertical - - - - - - - - True - True - 0 - - - - - True - False - 10 - start - - - True - True - True - - - True - False - - - True - False - gtk-ok - 1 - - - True - True - 0 - - - - - True - False - 0 - Freeze - - - True - True - 1 - - - - - - - False - False - 0 - - - - - True - True - True - - - True - False - - - True - False - gtk-edit - 1 - - - True - True - 0 - - - - - True - False - 0 - Modify - - - True - True - 1 - - - - - - - False - False - 1 - - - - - True - True - True - - - True - False - - - True - False - gtk-paste - 1 - - - True - True - 0 - - - - - True - False - 0 - Copy - - - True - True - 1 - - - - - - - False - False - 2 - - - - - False - False - 10 - 1 - - - - - True - True - 1 - - - - - True - False - 0 - 0 - label_resultsfound - True - - - False - False - 2 - - - - - True - False - 20 - center - - - True - True - True - - - True - False - - - True - False - gtk-ok - 1 - - - True - True - 0 - - - - - True - False - 0 - Search - - - True - True - 1 - - - - - - - False - False - 0 - - - - - True - True - True - - - True - False - - - True - False - gtk-undo - 1 - - - True - True - 0 - - - - - True - False - 0 - Restart - - - True - True - 1 - - - - - - - False - False - 1 - - - - - False - False - 3 - - - - - - - - - True - False - <b>Cheat Search</b> - True - - - - - True - True - 1 - - - - - - closebutton - - False Configure PCSXR @@ -920,7 +372,7 @@ 3 4 GTK_FILL - + @@ -1009,8 +461,8 @@ 5 1 2 - - + + @@ -1032,8 +484,8 @@ 5 2 3 - - + + @@ -1055,8 +507,8 @@ 5 3 4 - - + + @@ -1078,8 +530,8 @@ 5 4 5 - - + + @@ -1101,8 +553,8 @@ 4 4 5 - - + + @@ -1124,8 +576,8 @@ 4 3 4 - - + + @@ -1147,8 +599,8 @@ 4 2 3 - - + + @@ -1170,8 +622,8 @@ 4 1 2 - - + + @@ -1185,7 +637,7 @@ 1 2 GTK_FILL - + @@ -1201,7 +653,7 @@ 1 2 GTK_FILL - + @@ -1217,7 +669,7 @@ 2 3 GTK_FILL - + @@ -1233,7 +685,7 @@ 3 4 GTK_FILL - + @@ -1249,7 +701,7 @@ 4 5 GTK_FILL - + @@ -1269,8 +721,8 @@ 4 5 - - + + @@ -1299,7 +751,7 @@ 6 7 GTK_FILL - + @@ -1355,7 +807,7 @@ 5 6 GTK_FILL - + @@ -1390,8 +842,8 @@ 4 5 6 - - + + @@ -1413,8 +865,8 @@ 5 5 6 - - + + @@ -1462,8 +914,6 @@ 0 0 - 1 - 1 @@ -1476,8 +926,6 @@ 1 0 - 1 - 1 @@ -1489,8 +937,6 @@ 0 1 - 1 - 1 @@ -1503,8 +949,6 @@ 1 1 - 1 - 1 @@ -1526,8 +970,6 @@ 2 0 - 1 - 1 @@ -1551,8 +993,6 @@ 2 1 - 1 - 1 @@ -1588,1339 +1028,6 @@ btn_ConfClose - - False - Configure CPU - False - True - center-on-parent - dialog - - - True - False - vertical - - - True - False - end - - - gtk-close - True - True - True - True - - - False - False - 0 - - - - - False - True - end - 0 - - - - - True - False - 5 - 5 - - - True - False - 0 - - - True - False - 5 - 12 - - - SPU IRQ Always Enabled - True - True - False - True - 0 - True - - - 2 - 3 - GTK_FILL - - - - - - Black & White Movies - True - True - False - True - 0 - True - - - 3 - 4 - GTK_FILL - - - - - - SIO IRQ Always Enabled - True - True - False - True - 0 - True - - - 1 - 2 - GTK_FILL - - - - - - Disable XA Decoding - True - True - False - True - 0 - True - - - GTK_FILL - - - - - - Slow Boot - True - True - False - True - 0 - True - - - 5 - 6 - GTK_FILL - - - - - - Enable Interpreter CPU - True - True - False - True - 0 - True - - - 7 - 8 - GTK_FILL - - - - - - Enable Console Output - True - True - False - True - 0 - True - - - 6 - 7 - GTK_FILL - - - - - - Enable Debugger - True - True - False - True - 0 - True - - - 8 - 9 - GTK_FILL - - - - - - Parasite Eve 2, Vandal Hearts 1/2 Fix - True - True - False - True - 0 - True - - - 9 - 10 - GTK_FILL - - - - - - InuYasha Sengoku Battle Fix - True - True - False - True - 0 - True - - - 10 - 11 - GTK_FILL - - - - - - No memcard (COTS password option) - True - True - False - True - 0 - True - - - 11 - 12 - GTK_FILL - - - - - - Widescreen (GTE Hack) - True - True - False - True - 0 - True - - - 12 - 13 - GTK_FILL - - - - - - Compatibility hacks (Raystorm/VH-D/MML/Cart World/...) - True - True - False - True - 0 - True - - - 13 - 14 - GTK_FILL - - - - - - - - True - False - <b>Options</b> - True - - - - - False - True - 0 - - - - - True - False - 0 - - - True - False - 5 - 10 - - - True - False - CD Audio - True - - - False - False - 0 - - - - - True - False - liststore5 - - - - 0 - - - - - False - False - 1 - - - - - - - False - True - 1 - - - - - True - False - 0 - - - True - False - 5 - 10 - - - Autodetect - True - True - False - True - 0.5 - True - - - False - False - 0 - - - - - True - False - liststore1 - - - - 0 - - - - - False - False - 1 - - - - - - - True - False - <b>System Type</b> - True - - - - - False - True - 3 - - - - - True - False - 0 - - - True - False - 5 - 4 - - - True - False - Every - True - - - False - False - 0 - - - - - True - True - True - 3 - 3 - - - False - False - 1 - - - - - True - False - vblanks, max. - True - - - False - False - 2 - - - - - True - True - True - 3 - 3 - - - False - False - 3 - - - - - True - False - rewinds = - True - - - False - False - 4 - - - - - True - False - False - 5 - 5 - - - False - False - 5 - - - - - True - False - MB - True - - - False - False - 6 - - - - - - - True - False - <b>Rewind interval</b> - True - - - - - False - True - 2 - - - - - False - True - 2 - - - - - - closebutton1 - - - - False - PCSXR - False - pcsxr-icon.png - - - - True - False - - - True - False - - - True - False - _File - True - - - False - - - Run _CD - True - False - True - image2 - False - - - - - - - Run _ISO... - True - False - True - image3 - False - - - - - - - Run _BIOS - True - False - True - image4 - False - - - - - - - Run _EXE... - True - False - True - image5 - False - - - - - - - True - False - - - - - E_xit - True - False - True - image25 - False - - - - - - - - - - - True - False - _Emulator - True - - - False - - - _Continue - True - False - True - image6 - False - - - - - - - _Reset - True - False - True - image7 - False - - - - - - - _Shutdown - True - False - True - image20 - False - - - - - - - True - False - - - - - S_witch ISO... - True - False - True - image8 - False - - - - - - - True - False - - - - - _Save State - True - False - True - image9 - False - - - False - - - True - False - Slot _1 - True - - - - - - - True - False - Slot _2 - True - - - - - - - True - False - Slot _3 - True - - - - - - - True - False - Slot _4 - True - - - - - - - True - False - Slot _5 - True - - - - - - - True - False - Slot _6 - True - - - - - - True - False - Slot _7 - True - - - - - - True - False - Slot _8 - True - - - - - - True - False - Slot _9 - True - - - - - - _Other... - True - False - True - image19 - False - - - - - - - - - - - _Load State - True - False - True - image10 - False - - - False - - - True - False - Slot _1 - True - - - - - - - True - False - Slot _2 - True - - - - - - - True - False - Slot _3 - True - - - - - - - True - False - Slot _4 - True - - - - - - - True - False - Slot _5 - True - - - - - - - True - False - Slot _6 - True - - - - - - True - False - Slot _7 - True - - - - - - True - False - Slot _8 - True - - - - - - True - False - Slot _9 - True - - - - - - True - False - Slot _Recent - True - - - - - - _Other... - True - False - True - image1 - False - - - - - - - - - - - - - - - True - False - _Configuration - True - - - False - - - _Plugins & BIOS... - True - False - True - image11 - False - - - - - - - True - False - - - - - _Graphics... - True - False - True - image21 - False - - - - - _Sound... - True - False - True - image22 - False - - - - - CD-_ROM... - True - False - True - image23 - False - - - - - C_ontrollers... - True - False - True - image24 - False - - - - - _Link cable... - True - False - True - image42 - False - - - - - True - False - - - - - _Netplay... - True - False - True - image14 - False - - - - - - True - False - - - - - _CPU... - True - False - True - image12 - False - - - - - - _Memory Cards... - True - False - True - image13 - False - - - - - - - True - False - - - - - Chea_t - True - False - True - image15 - False - - - True - False - - - _Browse... - True - False - True - image16 - False - - - - - _Search... - True - False - True - image17 - False - - - - - - - - - Memory _Dump - True - False - True - image34 - False - - - - - - - - - True - False - _Help - True - - - False - - - _About PCSXR... - True - False - True - image18 - False - - - - - - - - - - False - False - 0 - - - - - True - False - 5 - 11 - - - True - False - True - Run CD - True - generated-icon-cd-png - - - - - True - False - True - Run ISO Image - True - generated-icon-iso-open-png - - - 1 - 2 - - - - - True - False - - - 2 - 3 - - - - - True - False - True - Continue Emulation - True - generated-icon-play-png - - - 3 - 4 - - - - - True - False - True - Switch ISO Image - True - generated-icon-iso-reopen-png - - - 4 - 5 - - - - - True - False - - - 5 - 6 - - - - - True - False - True - Configure Memory Cards - True - generated-icon-memcard-png - - - 6 - 7 - - - - - True - False - True - Configure Graphics - True - generated-icon-gpu-png - - - 7 - 8 - - - - - True - False - True - Configure Sound - True - generated-icon-spu-png - - - 8 - 9 - - - - - True - False - True - Configure CD-ROM - True - generated-icon-cdr-png - - - 9 - 10 - - - - - True - False - True - Configure Controllers - True - generated-icon-pad-png - - - 10 - 11 - - - - - False - False - 1 - - - - - True - False - pcsxr.png - - - True - True - 2 - - - - - True - False - 2 - - - False - True - 3 - - - - - False Configure Memory Cards @@ -4167,164 +2274,957 @@ True False gtk-open - 1 + 1 True False gtk-revert-to-saved - 1 + 1 True False gtk-preferences - 1 + 1 True False gtk-properties - 1 + 1 True False gtk-floppy - 1 + 1 True False gtk-properties - 1 + 1 True False gtk-indent - 1 + 1 True False gtk-index - 1 + 1 True False gtk-find - 1 + 1 True False gtk-about - 1 + 1 True False gtk-save-as - 1 + 1 True False 0.49000000953674316 gtk-cdrom - 1 + 1 True False gtk-stop - 1 + 1 True False gtk-select-color - 1 + 1 True False gtk-convert - 1 + 1 True False gtk-cdrom - 1 + 1 True False gtk-execute - 1 + 1 True False gtk-quit - 1 + 1 True False gtk-open - 1 + 1 True False gtk-revert-to-saved - 1 + 1 True False gtk-convert - 1 + 1 True False gtk-execute - 1 + 1 True False gtk-execute - 1 + 1 True False gtk-go-forward - 1 + 1 True False gtk-refresh - 1 + 1 True False gtk-open - 1 + 1 True False gtk-save-as - 1 + 1 + + + False + PCSXR + False + pcsxr-icon.png + + + + True + False + + + True + False + + + True + False + _File + True + + + False + + + Run _CD + True + False + True + image2 + False + + + + + + + Run _ISO... + True + False + True + image3 + False + + + + + + + Run _BIOS + True + False + True + image4 + False + + + + + + + Run _EXE... + True + False + True + image5 + False + + + + + + + True + False + + + + + E_xit + True + False + True + image25 + False + + + + + + + + + + + True + False + _Emulator + True + + + False + + + _Continue + True + False + True + image6 + False + + + + + + + _Reset + True + False + True + image7 + False + + + + + + + _Shutdown + True + False + True + image20 + False + + + + + + + True + False + + + + + S_witch ISO... + True + False + True + image8 + False + + + + + + + True + False + + + + + _Save State + True + False + True + image9 + False + + + False + + + True + False + Slot _1 + True + + + + + + + True + False + Slot _2 + True + + + + + + + True + False + Slot _3 + True + + + + + + + True + False + Slot _4 + True + + + + + + + True + False + Slot _5 + True + + + + + + + True + False + Slot _6 + True + + + + + + True + False + Slot _7 + True + + + + + + True + False + Slot _8 + True + + + + + + True + False + Slot _9 + True + + + + + + _Other... + True + False + True + image19 + False + + + + + + + + + + + _Load State + True + False + True + image10 + False + + + False + + + True + False + Slot _1 + True + + + + + + + True + False + Slot _2 + True + + + + + + + True + False + Slot _3 + True + + + + + + + True + False + Slot _4 + True + + + + + + + True + False + Slot _5 + True + + + + + + + True + False + Slot _6 + True + + + + + + True + False + Slot _7 + True + + + + + + True + False + Slot _8 + True + + + + + + True + False + Slot _9 + True + + + + + + True + False + Slot _Recent + True + + + + + + _Other... + True + False + True + image1 + False + + + + + + + + + + + + + + + True + False + _Configuration + True + + + False + + + _Plugins & BIOS... + True + False + True + image11 + False + + + + + + + True + False + + + + + _Graphics... + True + False + True + image21 + False + + + + + _Sound... + True + False + True + image22 + False + + + + + CD-_ROM... + True + False + True + image23 + False + + + + + C_ontrollers... + True + False + True + image24 + False + + + + + _Link cable... + True + False + True + image42 + False + + + + + True + False + + + + + _Netplay... + True + False + True + image14 + False + + + + + + True + False + + + + + _CPU... + True + False + True + image12 + False + + + + + + _Memory Cards... + True + False + True + image13 + False + + + + + + + True + False + + + + + Chea_t + True + False + True + image15 + False + + + True + False + + + _Browse... + True + False + True + image16 + False + + + + + _Search... + True + False + True + image17 + False + + + + + + + + + Memory _Dump + True + False + True + image34 + False + + + + + + + + + True + False + _Help + True + + + False + + + _About PCSXR... + True + False + True + image18 + False + + + + + + + + + + False + False + 0 + + + + + True + False + 5 + 11 + + + True + False + True + Run CD + True + generated-icon-cd-png + + + + + True + False + True + Run ISO Image + True + generated-icon-iso-open-png + + + 1 + 2 + + + + + True + False + + + 2 + 3 + + + + + True + False + True + Continue Emulation + True + generated-icon-play-png + + + 3 + 4 + + + + + True + False + True + Switch ISO Image + True + generated-icon-iso-reopen-png + + + 4 + 5 + + + + + True + False + + + 5 + 6 + + + + + True + False + True + Configure Memory Cards + True + generated-icon-memcard-png + + + 6 + 7 + + + + + True + False + True + Configure Graphics + True + generated-icon-gpu-png + + + 7 + 8 + + + + + True + False + True + Configure Sound + True + generated-icon-spu-png + + + 8 + 9 + + + + + True + False + True + Configure CD-ROM + True + generated-icon-cdr-png + + + 9 + 10 + + + + + True + False + True + Configure Controllers + True + generated-icon-pad-png + + + 10 + 11 + + + + + False + False + 1 + + + + + True + False + pcsxr.png + + + True + True + 2 + + + + + True + False + 2 + + + False + True + 3 + + + + @@ -4406,9 +3306,558 @@ + + False + 5 + Cheat Search + False + True + center-on-parent + dialog + + + True + False + vertical + 2 + + + True + False + end + + + gtk-close + True + True + True + True + + + False + False + 0 + + + + + False + True + end + 0 + + + + + True + False + 0 + + + True + False + 5 + 5 + 5 + + + True + False + 5 + + + True + False + 3 + 4 + 5 + 5 + + + True + False + liststore2 + + + + 0 + + + + + 1 + 2 + 1 + 2 + + + + + + True + False + 0 + Search For: + + + + + True + False + 0 + Data Type: + + + 1 + 2 + + + + + True + False + 0 + Value: + + + 2 + 3 + + + + + True + False + Data Base: + + + 2 + 3 + 1 + 2 + + + + + True + False + liststore3 + + + + 0 + + + + + 1 + 2 + + + + + + True + True + False + False + + + 1 + 2 + 2 + 3 + + + + + + True + False + liststore4 + + + + 0 + + + + + 3 + 4 + 1 + 2 + + + + + + True + False + To: + + + 2 + 3 + 2 + 3 + + + + + + + + True + True + False + False + + + 3 + 4 + 2 + 3 + + + + + + + + False + True + 0 + + + + + True + False + + + 450 + 250 + True + True + never + etched-in + + + True + True + False + False + vertical + + + + + + + + True + True + 0 + + + + + True + False + 10 + start + + + True + True + True + + + True + False + + + True + False + gtk-ok + 1 + + + True + True + 0 + + + + + True + False + 0 + Freeze + + + True + True + 1 + + + + + + + False + False + 0 + + + + + True + True + True + + + True + False + + + True + False + gtk-edit + 1 + + + True + True + 0 + + + + + True + False + 0 + Modify + + + True + True + 1 + + + + + + + False + False + 1 + + + + + True + True + True + + + True + False + + + True + False + gtk-paste + 1 + + + True + True + 0 + + + + + True + False + 0 + Copy + + + True + True + 1 + + + + + + + False + False + 2 + + + + + False + False + 10 + 1 + + + + + True + True + 1 + + + + + True + False + 0 + 0 + label_resultsfound + True + + + False + False + 2 + + + + + True + False + 20 + center + + + True + True + True + + + True + False + + + True + False + gtk-ok + 1 + + + True + True + 0 + + + + + True + False + 0 + Search + + + True + True + 1 + + + + + + + False + False + 0 + + + + + True + True + True + + + True + False + + + True + False + gtk-undo + 1 + + + True + True + 0 + + + + + True + False + 0 + Restart + + + True + True + 1 + + + + + + + False + False + 1 + + + + + False + False + 3 + + + + + + + + + True + False + <b>Cheat Search</b> + True + + + + + True + True + 1 + + + + + + closebutton + + - + @@ -4423,4 +3872,682 @@ + + False + Configure CPU + False + True + center-on-parent + dialog + + + True + False + vertical + + + True + False + end + + + gtk-close + True + True + True + True + + + False + False + 0 + + + + + False + True + end + 0 + + + + + True + False + 5 + 5 + + + True + False + 0 + + + True + False + 5 + 12 + + + + + + SPU IRQ Always Enabled + True + True + False + True + 0 + True + + + 2 + 3 + GTK_FILL + + + + + + Black & White Movies + True + True + False + True + 0 + True + + + 3 + 4 + GTK_FILL + + + + + + SIO IRQ Always Enabled + True + True + False + True + 0 + True + + + 1 + 2 + GTK_FILL + + + + + + Disable XA Decoding + True + True + False + True + 0 + True + + + GTK_FILL + + + + + + Slow Boot + True + True + False + True + 0 + True + + + 5 + 6 + GTK_FILL + + + + + + Enable Interpreter CPU + True + True + False + True + 0 + True + + + 7 + 8 + GTK_FILL + + + + + + Enable Console Output + True + True + False + True + 0 + True + + + 6 + 7 + GTK_FILL + + + + + + Enable Debugger + True + True + False + True + 0 + True + + + 8 + 9 + GTK_FILL + + + + + + Parasite Eve 2, Vandal Hearts 1/2 Fix + True + True + False + True + 0 + True + + + 9 + 10 + GTK_FILL + + + + + + InuYasha Sengoku Battle Fix + True + True + False + True + 0 + True + + + 10 + 11 + GTK_FILL + + + + + + No memcard (COTS password option) + True + True + False + True + 0 + True + + + 11 + 12 + GTK_FILL + + + + + + Widescreen (GTE Hack) + True + True + False + True + 0 + True + + + 12 + 13 + GTK_FILL + + + + + + Compatibility hacks (Raystorm/VH-D/MML/Cart World/...) + True + True + False + True + 0 + True + + + 13 + 14 + GTK_FILL + + + + + + + + True + False + <b>Options</b> + True + + + + + False + True + 0 + + + + + True + False + 0 + + + True + False + 5 + 10 + + + True + False + CD Audio + True + + + False + False + 0 + + + + + True + False + liststore5 + + + + 0 + + + + + False + False + 1 + + + + + + + False + True + 1 + + + + + True + False + 0 + + + True + False + 5 + 4 + + + True + False + Every + True + + + False + False + 0 + + + + + True + True + 3 + 3 + + + False + False + 1 + + + + + True + False + vblanks, max. + True + + + False + False + 2 + + + + + True + True + 3 + 3 + + + False + False + 3 + + + + + True + False + rewinds = + True + + + False + False + 4 + + + + + True + False + False + 5 + 5 + + + False + False + 5 + + + + + True + False + MB + True + + + False + False + 6 + + + + + + + True + False + <b>Rewind interval</b> + True + + + + + False + True + 2 + + + + + True + False + 0 + + + True + False + 5 + 4 + + + True + False + Alt1 + True + + + False + False + 0 + + + + + True + True + 4 + 4 + 4 + % + + + False + False + 1 + + + + + True + False + % + True + + + False + False + 2 + + + + + True + False + + + False + False + 4 + 3 + + + + + True + False + Alt2 + True + + + False + False + 4 + + + + + True + True + 4 + 4 + 4 + 0.11 + + + False + False + 5 + + + + + True + False + % + True + + + False + False + 6 + + + + + True + False + + + False + False + 4 + 7 + + + + + + + + + + True + False + <b>Alternate Speed</b> + True + + + + + False + True + 3 + + + + + True + False + 0 + + + True + False + 5 + 10 + + + Autodetect + True + True + False + True + 0.5 + True + + + False + False + 0 + + + + + True + False + liststore1 + + + + 0 + + + + + False + False + 1 + + + + + + + True + False + <b>System Type</b> + True + + + + + False + True + 4 + + + + + False + True + 2 + + + + + + closebutton1 + + diff --git a/gui/ConfDlg.c b/gui/ConfDlg.c index 966a58c0..d71326c7 100755 --- a/gui/ConfDlg.c +++ b/gui/ConfDlg.c @@ -899,6 +899,12 @@ void OnCpu_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) { sscanf(gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object(builder, "GtkEntry_RewindInterval"))), "%lu", &tmp); Config.RewindInterval = tmp; + sscanf(gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object(builder, "GtkEntry_AltSpeed1"))), "%lu", &tmp); + Config.AltSpeed1 = tmp; + + sscanf(gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object(builder, "GtkEntry_AltSpeed2"))), "%lu", &tmp); + Config.AltSpeed2 = tmp; + Config.Xa = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Xa"))); Config.SioIrq = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_SioIrq"))); Config.Mdec = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Mdec"))); @@ -981,6 +987,14 @@ void OnConf_Cpu() { // Enabled only if interpreter gtk_widget_set_sensitive(GTK_WIDGET(gtk_builder_get_object(builder, "frame_rew")), Config.Cpu); + snprintf(buf, sizeof(buf), "%u", Config.AltSpeed1); + widget = GTK_WIDGET(gtk_builder_get_object(builder, "GtkEntry_AltSpeed1")); + gtk_entry_set_text(GTK_ENTRY(widget), buf); + + snprintf(buf, sizeof(buf), "%u", Config.AltSpeed2); + widget = GTK_WIDGET(gtk_builder_get_object(builder, "GtkEntry_AltSpeed2")); + gtk_entry_set_text(GTK_ENTRY(widget), buf); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Xa")), Config.Xa); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_SioIrq")), Config.SioIrq); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Mdec")), Config.Mdec); diff --git a/gui/Config.c b/gui/Config.c index 3c0aa923..25e2e54b 100755 --- a/gui/Config.c +++ b/gui/Config.c @@ -148,6 +148,13 @@ int LoadConfig(PcsxConfig *Conf) { Config.RewindCount = GetValuel(data, "RewindCount"); Config.RewindInterval = GetValuel(data, "RewindInterval"); + Config.AltSpeed1 = GetValuel(data, "AltSpeed1"); + if (!Config.AltSpeed1) + Config.AltSpeed1 = 50; + Config.AltSpeed2 = GetValuel(data, "AltSpeed2"); + if (!Config.AltSpeed2) + Config.AltSpeed2 = 250; + Config.HackFix = GetValuel(data, "HackFix"); free(data); @@ -199,6 +206,9 @@ void SaveConfig() { SetValuel("RewindCount", Config.RewindCount); SetValuel("RewindInterval", Config.RewindInterval); + SetValuel("AltSpeed1", Config.AltSpeed1); + SetValuel("AltSpeed2", Config.AltSpeed2); + SetValuel("HackFix", Config.HackFix); fclose(f); diff --git a/gui/GtkGui.c b/gui/GtkGui.c index 04fbcd36..3185e51a 100755 --- a/gui/GtkGui.c +++ b/gui/GtkGui.c @@ -229,7 +229,11 @@ gchar* get_state_filename(int i) { trimlabel = get_cdrom_label_trim(); - sprintf(SStateFile, "%.32s-%.9s.%3.3d", trimlabel, CdromId, i); + if (i >= OLD_SLOT && i <= LAST_OLD_SLOT) { + sprintf(SStateFile, "%.32s-%.9s.old_%d", trimlabel, CdromId, i - OLD_SLOT); + } else { + sprintf(SStateFile, "%.32s-%.9s.%3.3d", trimlabel, CdromId, i); + } state_filename = g_build_filename (getenv("HOME"), STATES_DIR, SStateFile, NULL); g_free(trimlabel); diff --git a/gui/Linux.h b/gui/Linux.h index 4e1543c0..db70a2a9 100755 --- a/gui/Linux.h +++ b/gui/Linux.h @@ -37,6 +37,10 @@ #define CHEATS_DIR "/.pcsxr/cheats/" #define PATCHES_DIR "/.pcsxr/patches/" +#define OLD_SLOT 1000 +#define NUM_OLD_SLOTS 2 +#define LAST_OLD_SLOT (OLD_SLOT + NUM_OLD_SLOTS - 1) + extern gboolean UseGui; extern int StatesC; char cfgfile[MAXPATHLEN]; /* ADB Comment this out - make a local var, or at least use gchar funcs */ diff --git a/gui/MemcardDlg.c b/gui/MemcardDlg.c index e0e15d9d..b777126e 100755 --- a/gui/MemcardDlg.c +++ b/gui/MemcardDlg.c @@ -137,7 +137,7 @@ static gchar* MCDStatusToChar(McdBlock *Info) { state = _("Link"); else if (ISLINKENDBLOCK(Info)) state = _("End link"); - } else + } else state = _("Free"); return state; } @@ -203,8 +203,20 @@ static void LoadListItems(int mcd, boolean newstore) { if (newstore) gtk_list_store_append(store, &iter); + GError *error=NULL; title = g_convert(Info->sTitle, strlen(Info->sTitle), "UTF-8", - "Shift-JIS", NULL, NULL, NULL); + "Shift-JIS", NULL, NULL, &error); + + if (error) + { + // Some characters caused problems because of custom encoding. + // Let's use the ASCII title as fallback. + // Otherwise custom decoding from that region + // of BIOS needed which is way overkill here. + title = g_convert(Info->Title, strlen(Info->Title), "UTF-8", + "Shift-JIS", NULL, NULL, NULL); + g_clear_error(&error); + } gtk_list_store_set(store, &iter, CL_ICON, pixbuf, diff --git a/gui/Plugin.c b/gui/Plugin.c index 08627455..0adf3b5e 100755 --- a/gui/Plugin.c +++ b/gui/Plugin.c @@ -42,6 +42,8 @@ extern void LidInterrupt(); unsigned long gpuDisp; int StatesC = 0; +unsigned char loadedOld = FALSE; +int speed = 100; extern int UseGui; void gpuShowPic() { @@ -77,9 +79,23 @@ void gpuShowPic() { void KeyStateSave(int i) { gchar *state_filename; + gchar *oldname, *newname; + int j; state_filename = get_state_filename (i); + if (i < OLD_SLOT && !loadedOld) { + newname = get_state_filename (LAST_OLD_SLOT); + for (j = LAST_OLD_SLOT - 1; j >= OLD_SLOT; --j) { + oldname = get_state_filename (j); + rename(oldname, newname); + g_free (newname); + newname = oldname; + } + rename(state_filename, newname); + g_free (newname); + } state_save (state_filename); + loadedOld = FALSE; g_free (state_filename); } @@ -87,6 +103,8 @@ void KeyStateSave(int i) { void KeyStateLoad(int i) { gchar *state_filename; + loadedOld = (i >= OLD_SLOT && i <= LAST_OLD_SLOT); + state_filename = get_state_filename (i); state_load (state_filename); @@ -108,6 +126,7 @@ void PADhandleKey(int key) { char Text[MAXPATHLEN]; gchar *state_filename; time_t now; + int slot; short rel = 0; //released key flag @@ -155,69 +174,20 @@ void PADhandleKey(int key) { if (modalt) KeyStateLoad(10); break; - case XK_1: + case XK_1: case XK_2: case XK_3: case XK_4: case XK_5: + case XK_6: case XK_7: case XK_8: case XK_9: + slot = key - XK_1; if (modalt && modctrl) return; - if (modalt) KeyStateLoad(0); - if (modctrl) KeyStateSave(0); - break; - case XK_2: - if (modalt && modctrl) - return; - if (modalt) KeyStateLoad(1); - if (modctrl) KeyStateSave(1); - break; - case XK_3: - if (modalt && modctrl) - return; - if (modalt) KeyStateLoad(2); - if (modctrl) KeyStateSave(2); - break; - case XK_4: - if (modalt && modctrl) - return; - if (modalt) KeyStateLoad(3); - if (modctrl) KeyStateSave(3); - break; - case XK_5: - if (modalt && modctrl) - return; - if (modalt) KeyStateLoad(4); - if (modctrl) KeyStateSave(4); - break; - case XK_6: - if (modalt && modctrl) - return; - if (modalt) KeyStateLoad(5); - if (modctrl) KeyStateSave(5); - break; - case XK_7: - if (modalt && modctrl) - return; - if (modalt) KeyStateLoad(6); - if (modctrl) KeyStateSave(6); - break; - case XK_8: - if (modalt && modctrl) - return; - if (modalt) KeyStateLoad(7); - if (modctrl) KeyStateSave(7); - break; - case XK_9: - if (modalt && modctrl) - return; - if (modalt) KeyStateLoad(8); - if (modctrl) KeyStateSave(8); + if (modalt) KeyStateLoad(slot); + else if (modctrl) KeyStateSave(slot); + else KeyStateLoad(OLD_SLOT + slot); break; case XK_F1: GPU_freeze(2, (GPUFreeze_t *)&StatesC); - state_filename = get_state_filename (StatesC); - state_save (state_filename); - - g_free (state_filename); + KeyStateSave(StatesC); gpuShowPic(); - break; case XK_F2: if (StatesC < (MAX_SLOTS - 1)) StatesC++; @@ -226,15 +196,7 @@ void PADhandleKey(int key) { gpuShowPic(); break; case XK_F3: - state_filename = get_state_filename (StatesC); - state_load (state_filename); - - g_free (state_filename); - - // HACKHACK: prevent crash when using recompiler due to execution not - // returned from compiled code. This WILL cause memory leak, however a - // large amount of refactor is needed for a proper fix. - if (Config.Cpu == CPU_DYNAREC) psxCpu->Execute(); + KeyStateLoad(StatesC); gpuShowPic(); break; case XK_F4: @@ -290,6 +252,22 @@ void PADhandleKey(int key) { tslastpressed = now; RewindState(); break; + case XK_bracketleft: + if (speed == Config.AltSpeed1) { + speed = 100; + } else { + speed = Config.AltSpeed1; + } + GPU_setSpeed(speed / 100.0); + break; + case XK_bracketright: + if (speed == Config.AltSpeed2) { + speed = 100; + } else { + speed = Config.AltSpeed2; + } + GPU_setSpeed(speed / 100.0); + break; case XK_Escape: // TODO // the architecture is too broken to actually restart the GUI @@ -298,8 +276,10 @@ void PADhandleKey(int key) { // Fixing this would probably require a complete reworking of // all functions, so that they return 0 or 1 for success // that way, execution wouldn't continue - if (CdromId[0] != '\0') + if (CdromId[0] != '\0') { + loadedOld = TRUE; KeyStateSave(10); + } ClosePlugins(); UpdateMenuSlots(); if (!UseGui) OnFile_Exit(); diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index 2aa6f9ad..f92cdd22 100755 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -1328,7 +1328,7 @@ void cdrWrite1(unsigned char rt) { set_loc[i] = btoi(cdr.Param[i]); i = msf2sec(cdr.SetSectorPlay); - i = abs(i - msf2sec(set_loc)); + i = abs(i - (int)msf2sec(set_loc)); if (i > 16) cdr.Seeked = SEEK_PENDING; diff --git a/libpcsxcore/ix86/iR3000A.c b/libpcsxcore/ix86/iR3000A.c index 2ba1cd18..3d662537 100755 --- a/libpcsxcore/ix86/iR3000A.c +++ b/libpcsxcore/ix86/iR3000A.c @@ -418,6 +418,8 @@ static int recInit() { for (i = 0; i < 0x08; i++) psxRecLUT[i + 0xbfc0] = (u32)&recROM[i << 16]; + x86Init(); + return 0; } @@ -425,8 +427,6 @@ static void recReset() { memset(recRAM, 0, 0x200000); memset(recROM, 0, 0x080000); - x86Init(); - x86SetPtr(recMem); branch = 0; diff --git a/libpcsxcore/ix86_64/iR3000A-64.c b/libpcsxcore/ix86_64/iR3000A-64.c index 13cb432c..5c24142a 100755 --- a/libpcsxcore/ix86_64/iR3000A-64.c +++ b/libpcsxcore/ix86_64/iR3000A-64.c @@ -482,6 +482,9 @@ static int recInit() { for (i=0; i<0x08; i++) psxRecLUT[i + 0xbfc0] = (uptr)&recROM[PTRMULT*(i << 16)]; + //x86Init(); + cpudetectInit(); + return 0; } @@ -489,8 +492,6 @@ static void recReset() { memset(recRAM, 0, 0x200000 * PTRMULT); memset(recROM, 0, 0x080000 * PTRMULT); - //x86Init(); - cpudetectInit(); x86SetPtr(recMem); branch = 0; diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index f0f1c4ee..33944cd3 100755 --- a/libpcsxcore/misc.c +++ b/libpcsxcore/misc.c @@ -229,8 +229,17 @@ int LoadCdromFile(const char *filename, EXE_HEADER *head) { u8 time[4],*buf; u8 mdir[4096], exename[256]; u32 size, addr; + void *psxaddr; - sscanf(filename, "cdrom:\\%255s", exename); + if (sscanf(filename, "cdrom:\\%255s", exename) <= 0) + { + // Some games omit backslash (NFS4) + if (sscanf(filename, "cdrom:%255s", exename) <= 0) + { + SysPrintf("LoadCdromFile: EXE NAME PARSING ERROR (%s (%u))\n", filename, strlen(filename)); + exit (1); + } + } time[0] = itob(0); time[1] = itob(2); time[2] = itob(0x10); @@ -259,7 +268,9 @@ int LoadCdromFile(const char *filename, EXE_HEADER *head) { incTime(); READTRACK(); - memcpy((void *)PSXM(addr), buf + 12, 2048); + psxaddr = (void *)PSXM(addr); + assert(psxaddr != NULL); + memcpy(psxaddr, buf + 12, 2048); size -= 2048; addr += 2048; @@ -360,13 +371,15 @@ int CheckCdrom() { static int PSXGetFileType(FILE *f) { unsigned long current; - u8 mybuf[2048]; + u8 mybuf[sizeof(EXE_HEADER)]; // EXE_HEADER currently biggest EXE_HEADER *exe_hdr; FILHDR *coff_hdr; + size_t amt; + memset(mybuf, 0, sizeof(mybuf)); current = ftell(f); fseek(f, 0L, SEEK_SET); - fread(mybuf, 2048, 1, f); + amt = fread(mybuf, sizeof(mybuf), 1, f); fseek(f, current, SEEK_SET); exe_hdr = (EXE_HEADER *)mybuf; @@ -408,6 +421,7 @@ int Load(const char *ExePath) { int retval = 0; u8 opcode; u32 section_address, section_size; + void* psxmaddr; strncpy(CdromId, "SLUS99999", 9); strncpy(CdromLabel, "SLUS_999.99", 11); @@ -479,7 +493,9 @@ int Load(const char *ExePath) { fseek(tmpFile, SWAP32(section.s_scnptr), SEEK_SET); fread(PSXM(SWAP32(section.s_paddr)), SWAP32(section.s_size), 1, tmpFile); } else { - memset(PSXM(SWAP32(section.s_paddr)), 0, SWAP32(section.s_size)); + psxmaddr = PSXM(SWAP32(section.s_paddr)); + assert(psxmaddr != NULL); + memset(psxmaddr, 0, SWAP32(section.s_size)); } } break; diff --git a/libpcsxcore/plugins.c b/libpcsxcore/plugins.c index 54c7e468..1713670e 100755 --- a/libpcsxcore/plugins.c +++ b/libpcsxcore/plugins.c @@ -54,6 +54,7 @@ GPUvBlank GPU_vBlank; GPUvisualVibration GPU_visualVibration; GPUcursor GPU_cursor; GPUaddVertex GPU_addVertex; +GPUsetSpeed GPU_setSpeed; GPUpgxpMemory GPU_pgxpMemory; CDRinit CDR_init; @@ -215,6 +216,7 @@ void CALLBACK GPU__vBlank(int val) {} void CALLBACK GPU__visualVibration(unsigned long iSmall, unsigned long iBig) {} void CALLBACK GPU__cursor(int player, int x, int y) {} void CALLBACK GPU__addVertex(short sx,short sy,s64 fx,s64 fy,s64 fz) {} +void CALLBACK GPU__setSpeed(float newSpeed) {} void CALLBACK GPU__pgxpMemory(unsigned char* pMem, unsigned int count, unsigned int addr, unsigned char* pVRAM) {} #define LoadGpuSym1(dest, name) \ @@ -261,6 +263,7 @@ static int LoadGPUplugin(const char *GPUdll) { LoadGpuSym0(visualVibration, "GPUvisualVibration"); LoadGpuSym0(cursor, "GPUcursor"); LoadGpuSym0(addVertex, "GPUaddVertex"); + LoadGpuSym0(setSpeed, "GPUsetSpeed"); LoadGpuSym0(pgxpMemory, "GPUpgxpMemory"); LoadGpuSym0(configure, "GPUconfigure"); LoadGpuSym0(test, "GPUtest"); diff --git a/libpcsxcore/plugins.h b/libpcsxcore/plugins.h index 8f2cc189..c77c0ae0 100755 --- a/libpcsxcore/plugins.h +++ b/libpcsxcore/plugins.h @@ -96,6 +96,7 @@ typedef void (CALLBACK* GPUvBlank)(int); typedef void (CALLBACK* GPUvisualVibration)(uint32_t, uint32_t); typedef void (CALLBACK* GPUcursor)(int, int, int); typedef void (CALLBACK* GPUaddVertex)(short,short,s64,s64,s64); +typedef void (CALLBACK* GPUsetSpeed)(float); // 1.0 = natural speed typedef void (CALLBACK* GPUpgxpMemory)(unsigned int, unsigned char*); // GPU function pointers @@ -126,6 +127,7 @@ extern GPUvBlank GPU_vBlank; extern GPUvisualVibration GPU_visualVibration; extern GPUcursor GPU_cursor; extern GPUaddVertex GPU_addVertex; +extern GPUsetSpeed GPU_setSpeed; extern GPUpgxpMemory GPU_pgxpMemory; // CD-ROM Functions diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index 204e7536..2f6ce415 100755 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -165,12 +165,21 @@ char *biosC0n[256] = { #define ra (psxRegs.GPR.n.ra) #define pc0 (psxRegs.pc) +#ifdef __NO_ASSERTS__ #define Ra0 ((char *)PSXM(a0)) #define Ra1 ((char *)PSXM(a1)) #define Ra2 ((char *)PSXM(a2)) #define Ra3 ((char *)PSXM(a3)) #define Rv0 ((char *)PSXM(v0)) #define Rsp ((char *)PSXM(sp)) +#else +#define Ra0 (assert(PSXM(a0) != NULL), (char *)PSXM(a0)) +#define Ra1 (assert(PSXM(a1) != NULL), (char *)PSXM(a1)) +#define Ra2 (assert(PSXM(a2) != NULL), (char *)PSXM(a2)) +#define Ra3 (assert(PSXM(a3) != NULL), (char *)PSXM(a3)) +#define Rv0 (assert(PSXM(v0) != NULL), (char *)PSXM(v0)) +#define Rsp (assert(PSXM(sp) != NULL), (char *)PSXM(sp)) +#endif typedef struct { u32 desc; @@ -655,7 +664,7 @@ void psxBios_memset() { // 0x2b while((s32)a2 > 0) { a2--; - psxMu8ref(a0) = a1; + *PSXM(a0) = a1; a0++; } } @@ -964,7 +973,7 @@ void psxBios_printf() { // 0x3f char *ptmp = tmp; int n=1, i=0, j; - memcpy(save, (char*)PSXM(sp), 4 * 4); + memcpy(save, Rsp, 4 * 4); psxMu32ref(sp) = SWAP32((u32)a0); psxMu32ref(sp + 4) = SWAP32((u32)a1); psxMu32ref(sp + 8) = SWAP32((u32)a2); @@ -1018,7 +1027,7 @@ _start: } *ptmp = 0; - memcpy((char*)PSXM(sp), save, 4 * 4); + memcpy(Rsp, save, 4 * 4); #ifdef PSXBIOS_LOG PSXBIOS_LOG("psxBios_%s: %s\n", biosA0n[0x3f], tmp); @@ -1273,16 +1282,34 @@ void psxBios_SetMem() { // 9f } void psxBios__card_info() { // ab - // COTS password option - boolean nocard = (Config.NoMemcard || ((strlen(Config.Mcd1) <=0) && (strlen(Config.Mcd2) <=0))); + u32 ret; #ifdef PSXBIOS_LOG - PSXBIOS_LOG("psxBios_%s: %x\n", biosA0n[0xab], a0); + PSXBIOS_LOG("psxBios_%s: 0x%x\n", biosA0n[0xab], a0); #endif card_active_chan = a0; + switch (card_active_chan) { + case 0x00: case 0x01: case 0x02: case 0x03: + ret = Config.Mcd1[0] ? 0x2 : 0x8; + break; + case 0x10: case 0x11: case 0x12: case 0x13: + ret = Config.Mcd2[0] ? 0x2 : 0x8; + break; + default: +#ifdef PSXBIOS_LOG + PSXBIOS_LOG("psxBios_%s: UNKNOWN PORT 0x%x\n", biosA0n[0xab], card_active_chan); +#endif + ret = 0x11; + break; + } + + // COTS password option + if (Config.NoMemcard) + ret = 0x8; + // DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004 - DeliverEvent(0x81, nocard ? 0x8 : 0x2); // 0xf4000001, 0x0004 + DeliverEvent(0x81, ret); // 0xf4000001, 0x0004 v0 = 1; pc0 = ra; } @@ -1673,43 +1700,68 @@ void psxBios_UnDeliverEvent() { // 0x20 pc0 = ra; } -#define buopen(mcd) { \ - strcpy(FDesc[1 + mcd].name, Ra0+5); \ - FDesc[1 + mcd].offset = 0; \ - FDesc[1 + mcd].mode = a1; \ - \ - for (i=1; i<16; i++) { \ - ptr = Mcd##mcd##Data + 128 * i; \ - if ((*ptr & 0xF0) != 0x50) continue; \ - if (strcmp(FDesc[1 + mcd].name, ptr+0xa)) continue; \ - FDesc[1 + mcd].mcfile = i; \ - SysPrintf("open %s\n", ptr+0xa); \ - v0 = 1 + mcd; \ - break; \ - } \ - if (a1 & 0x200 && v0 == -1) { /* FCREAT */ \ - for (i=1; i<16; i++) { \ - int j, xor = 0; \ - \ - ptr = Mcd##mcd##Data + 128 * i; \ - if ((*ptr & 0xF0) == 0x50) continue; \ - ptr[0] = 0x50 | (u8)(a1 >> 16); \ - ptr[4] = 0x00; \ - ptr[5] = 0x20; \ - ptr[6] = 0x00; \ - ptr[7] = 0x00; \ - ptr[8] = 'B'; \ - ptr[9] = 'I'; \ - strcpy(ptr+0xa, FDesc[1 + mcd].name); \ - for (j=0; j<127; j++) xor^= ptr[j]; \ - ptr[127] = xor; \ - FDesc[1 + mcd].mcfile = i; \ - SysPrintf("openC %s\n", ptr); \ - v0 = 1 + mcd; \ - SaveMcd(Config.Mcd##mcd, Mcd##mcd##Data, 128 * i, 128); \ - break; \ - } \ - } \ +static void buopen(int mcd, u8 *ptr, u8 *cfg) +{ + int i; + u8 *fptr = 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; + if ((*fptr & 0xF0) != 0x50) continue; + if (strcmp(FDesc[1 + mcd].name, fptr+0xa)) continue; + FDesc[1 + mcd].mcfile = i; + SysPrintf("open %s\n", fptr+0xa); + v0 = 1 + mcd; + break; + } + if (a1 & 0x200 && v0 == -1) { /* FCREAT */ + fptr = ptr; + for (i=1; i<16; i++) { + int j, xor, nblk = a1 >> 16; + u8 *pptr, *fptr2; + + fptr += 128; + if ((*fptr & 0xF0) != 0xa0) continue; + + FDesc[1 + mcd].mcfile = i; + fptr[0] = 0x51; + fptr[4] = 0x00; + fptr[5] = 0x20 * nblk; + fptr[6] = 0x00; + fptr[7] = 0x00; + strcpy(fptr+0xa, FDesc[1 + mcd].name); + pptr = fptr2 = fptr; + for(j=2; j<=nblk; j++) { + int k; + for(i++; i<16; i++) { + fptr2 += 128; + + memset(fptr2, 0, 128); + fptr2[0] = j < nblk ? 0x52 : 0x53; + pptr[8] = i - 1; + pptr[9] = 0; + for (k=0, xor=0; k<127; k++) xor^= pptr[k]; + pptr[127] = xor; + pptr = fptr2; + break; + } + /* shouldn't this return ENOSPC if i == 16? */ + } + pptr[8] = pptr[9] = 0xff; + for (j=0, xor=0; j<127; j++) xor^= pptr[j]; + pptr[127] = xor; + SysPrintf("openC %s %d\n", ptr, nblk); + v0 = 1 + mcd; + /* just go ahead and resave them all */ + SaveMcd(cfg, ptr, 128, 128 * 15); + break; + } + /* shouldn't this return ENOSPC if i == 16? */ + } } /* @@ -1717,8 +1769,7 @@ void psxBios_UnDeliverEvent() { // 0x20 */ void psxBios_open() { // 0x32 - int i; - char *ptr; + #ifdef PSXBIOS_LOG PSXBIOS_LOG("psxBios_%s: %s,%x\n", biosB0n[0x32], Ra0, a1); @@ -1727,11 +1778,11 @@ void psxBios_open() { // 0x32 v0 = -1; if (!strncmp(Ra0, "bu00", 4)) { - buopen(1); + buopen(1, Mcd1Data, Config.Mcd1); } if (!strncmp(Ra0, "bu10", 4)) { - buopen(2); + buopen(2, Mcd2Data, Config.Mcd2); } pc0 = ra; @@ -1770,7 +1821,7 @@ void psxBios_lseek() { // 0x33 if (FDesc[1 + mcd].mode & 0x8000) v0 = 0; \ else v0 = a2; \ FDesc[1 + mcd].offset += v0; \ - DeliverEvent(0x11, 0x2); /* 0xf0000011, 0x0004 */ \ + DeliverEvent(0x11, 0x2); /* 0xf0000011, 0x0004 */ \ DeliverEvent(0x81, 0x2); /* 0xf4000001, 0x0004 */ \ } @@ -1791,7 +1842,7 @@ void psxBios_read() { // 0x34 case 2: buread(1); break; case 3: buread(2); break; } - + pc0 = ra; } @@ -1804,7 +1855,7 @@ void psxBios_read() { // 0x34 SaveMcd(Config.Mcd##mcd, Mcd##mcd##Data, offset, a2); \ if (FDesc[1 + mcd].mode & 0x8000) v0 = 0; \ else v0 = a2; \ - DeliverEvent(0x11, 0x2); /* 0xf0000011, 0x0004 */ \ + DeliverEvent(0x11, 0x2); /* 0xf0000011, 0x0004 */ \ DeliverEvent(0x81, 0x2); /* 0xf4000001, 0x0004 */ \ } @@ -1855,21 +1906,21 @@ char psxstrbuf[PSXSTRBUFMAX+1]; unsigned short psxstrbuf_count = 0; void psxBios_putchar() { // 3d - char logchar = ( a0 == 0xa ? '>' : (char)a0 ); - if (psxstrbuf_count < PSXSTRBUFMAX) psxstrbuf[psxstrbuf_count++] = logchar; + char logchar = ( a0 == 0xa ? '>' : (char)a0 ); + if (psxstrbuf_count < PSXSTRBUFMAX) psxstrbuf[psxstrbuf_count++] = logchar; #ifdef PSXBIOS_LOG PSXBIOS_LOG("psxBios_%s: %x (%c)\n", biosB0n[0x3d], a0, logchar); #else SysPrintf("%c", (char)a0); #endif - if ((a0 == 0xa && psxstrbuf_count >= 2) || psxstrbuf_count >= PSXSTRBUFMAX) { - psxstrbuf[psxstrbuf_count++] = '\0'; + if ((a0 == 0xa && psxstrbuf_count >= 2) || psxstrbuf_count >= PSXSTRBUFMAX) { + psxstrbuf[psxstrbuf_count++] = '\0'; #ifdef PSXBIOS_LOG - PSXBIOS_LOG("psxBios_%s: string_[%d]_cr: %s\n", biosB0n[0x3d], psxstrbuf_count, psxstrbuf); + PSXBIOS_LOG("psxBios_%s: string_[%d]_cr: %s\n", biosB0n[0x3d], psxstrbuf_count, psxstrbuf); #endif - psxstrbuf_count = 0; - } + psxstrbuf_count = 0; + } pc0 = ra; } @@ -1890,17 +1941,18 @@ int nfile; while (nfile < 16) { \ int match=1; \ \ - ptr = Mcd##mcd##Data + 128 * nfile; \ + ptr = Mcd##mcd##Data + 128 * (nfile + 1); \ nfile++; \ if ((*ptr & 0xF0) != 0x50) continue; \ + /* Bug link files show up as free block. */ \ + if (!ptr[0xa]) continue; \ ptr+= 0xa; \ if (pfile[0] == 0) { \ strncpy(dir->name, ptr, sizeof(dir->name)); \ - dir->name[sizeof(dir->name) - 1] = '\0'; \ + dir->name[sizeof(dir->name)] = '\0'; \ } else for (i=0; i<20; i++) { \ if (pfile[i] == ptr[i]) { \ - dir->name[i] = ptr[i]; \ - if (ptr[i] == 0) break; else continue; } \ + dir->name[i] = ptr[i]; continue; } \ if (pfile[i] == '?') { \ dir->name[i] = ptr[i]; continue; } \ if (pfile[i] == '*') { \ @@ -1908,7 +1960,7 @@ int nfile; match = 0; break; \ } \ SysPrintf("%d : %s = %s + %s (match=%d)\n", nfile, dir->name, pfile, ptr, match); \ - if (match == 0) continue; \ + if (match == 0) { continue; } \ dir->size = 8192; \ v0 = _dir; \ break; \ @@ -1933,10 +1985,13 @@ void psxBios_firstfile() { // 42 strcpy(ffile, Ra0); pfile = ffile+5; - nfile = 1; + nfile = 0; + if (!strncmp(Ra0, "bu00", 4)) { + DeliverEvent(0x11, 0x2); bufile(1); } else if (!strncmp(Ra0, "bu10", 4)) { + DeliverEvent(0x11, 0x2); bufile(2); } @@ -2082,21 +2137,21 @@ void psxBios_StopCARD() { // 4c } void psxBios__card_write() { // 0x4e - int port; + int const port = a0 >> 4; + u32 const sect = a1 % (MCD_SIZE/8); // roll on range 0...3FFF #ifdef PSXBIOS_LOG - PSXBIOS_LOG("psxBios_%s: %x,%x,%x\n", biosB0n[0x4e], a0, a1, a2); + PSXBIOS_LOG("psxBios_%s, PORT=%i, SECT=%u(%u), DEST=%p\n", biosB0n[0x4e], port, sect, a1, a2); #endif card_active_chan = a0; - port = a0 >> 4; if (port == 0) { - memcpy(Mcd1Data + a1 * 128, Ra2, 128); - SaveMcd(Config.Mcd1, Mcd1Data, a1 * 128, 128); + memcpy(Mcd1Data + (sect * MCD_SECT_SIZE), Ra2, MCD_SECT_SIZE); + SaveMcd(Config.Mcd1, Mcd1Data, sect * MCD_SECT_SIZE, MCD_SECT_SIZE); } else { - memcpy(Mcd2Data + a1 * 128, Ra2, 128); - SaveMcd(Config.Mcd2, Mcd2Data, a1 * 128, 128); + memcpy(Mcd2Data + (sect * MCD_SECT_SIZE), Ra2, MCD_SECT_SIZE); + SaveMcd(Config.Mcd2, Mcd2Data, sect * MCD_SECT_SIZE, MCD_SECT_SIZE); } DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004 @@ -2106,19 +2161,19 @@ void psxBios__card_write() { // 0x4e } void psxBios__card_read() { // 0x4f - int port; + int const port = a0 >> 4; + u32 const sect = a1 % (MCD_SIZE/8); // roll on range 0...3FFF #ifdef PSXBIOS_LOG - PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x4f]); + PSXBIOS_LOG("psxBios_%s, PORT=%i, SECT=%u(%u), DEST=%p\n", biosB0n[0x4f], port, sect, a1, a2); #endif card_active_chan = a0; - port = a0 >> 4; if (port == 0) { - memcpy(Ra2, Mcd1Data + a1 * 128, 128); + memcpy(Ra2, Mcd1Data + (sect * MCD_SECT_SIZE), MCD_SECT_SIZE); } else { - memcpy(Ra2, Mcd2Data + a1 * 128, 128); + memcpy(Ra2, Mcd2Data + (sect * MCD_SECT_SIZE), MCD_SECT_SIZE); } DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004 @@ -2178,6 +2233,15 @@ void psxBios_Krom2RawAdd() { // 0x51 pc0 = ra; } +// stub? +void psxBios__get_error() { // 55 +#ifdef PSXBIOS_LOG + PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x55]); +#endif + + v0 = 0; pc0 = ra; +} + void psxBios_GetC0Table() { // 56 #ifdef PSXBIOS_LOG PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x56]); @@ -2566,7 +2630,7 @@ void psxBiosInit() { //biosB0[0x52] = psxBios_sys_b0_52; //biosB0[0x53] = psxBios_sys_b0_53; //biosB0[0x54] = psxBios__get_errno; - //biosB0[0x55] = psxBios__get_error; + biosB0[0x55] = psxBios__get_error; biosB0[0x56] = psxBios_GetC0Table; biosB0[0x57] = psxBios_GetB0Table; biosB0[0x58] = psxBios__card_chan; diff --git a/libpcsxcore/psxcommon.h b/libpcsxcore/psxcommon.h index fc1a0c02..3f13dfa8 100755 --- a/libpcsxcore/psxcommon.h +++ b/libpcsxcore/psxcommon.h @@ -159,6 +159,8 @@ typedef struct { u8 PsxType; // PSX_TYPE_NTSC or PSX_TYPE_PAL u32 RewindCount; u32 RewindInterval; + u32 AltSpeed1; // Percent relative to natural speed. + u32 AltSpeed2; u8 HackFix; #ifdef _WIN32 char Lang[256]; diff --git a/libpcsxcore/sio.c b/libpcsxcore/sio.c index 22ca23e5..e4b8fea1 100755 --- a/libpcsxcore/sio.c +++ b/libpcsxcore/sio.c @@ -59,6 +59,10 @@ void SaveDongle( char *str ); static unsigned char buf[ BUFFER_SIZE ]; +//[0] -> dummy +//[1] -> memory card status flag +//[2] -> card 1 id, 0x5a->plugged, any other not plugged +//[3] -> card 2 id, 0x5d->plugged, any other not plugged unsigned char cardh[4] = { 0x00, 0x08, 0x5a, 0x5d }; // Transfer Ready and the Buffer is Empty @@ -722,10 +726,12 @@ void sioWrite8(unsigned char value) { StatReg |= RX_RDY; // Chronicles of the Sword - no memcard = password options - if( Config.NoMemcard || ((strlen(Config.Mcd1) <=0) && (strlen(Config.Mcd2) <=0)) ) { + if( Config.NoMemcard || (!Config.Mcd1[0] && !Config.Mcd2[0])) { memset(buf, 0x00, 4); } else { memcpy(buf, cardh, 4); + if (!Config.Mcd1[0]) buf[2]=0; // is card 1 plugged? (Codename Tenka) + if (!Config.Mcd2[0]) buf[3]=0; // is card 2 plugged? } parp = 0; @@ -883,8 +889,8 @@ void LoadMcd(int mcd, char *str) { if (mcd == 2) data = Mcd2Data; if (*str == 0) { - sprintf(str, "%s/.pcsxr/memcards/card%d.mcd", getenv("HOME"), mcd); // TODO: maybe just whine and quit.. - SysPrintf(_("No memory card value was specified - using a default card %s\n"), str); + SysPrintf(_("No memory card value was specified - card %i is not plugged.\n"), mcd); + return; } f = fopen(str, "rb"); if (f == NULL) { diff --git a/libpcsxcore/sio.h b/libpcsxcore/sio.h index f22218b3..64993992 100755 --- a/libpcsxcore/sio.h +++ b/libpcsxcore/sio.h @@ -31,7 +31,8 @@ extern "C" { #include "plugins.h" #include "psemu_plugin_defs.h" -#define MCD_SIZE (1024 * 8 * 16) +#define MCD_SECT_SIZE (8 * 16) +#define MCD_SIZE (1024 * MCD_SECT_SIZE) extern char Mcd1Data[MCD_SIZE], Mcd2Data[MCD_SIZE]; diff --git a/macosx/Pcsxr-QL/GeneratePreviewForURL.m b/macosx/Pcsxr-QL/GeneratePreviewForURL.m index 7076b380..d755ca95 100644 --- a/macosx/Pcsxr-QL/GeneratePreviewForURL.m +++ b/macosx/Pcsxr-QL/GeneratePreviewForURL.m @@ -118,7 +118,7 @@ static OSStatus GeneratePreviewForMemCard(void *thisInterface, QLPreviewRequestR NSDictionary *imgProps = @{(NSString *)kQLPreviewPropertyAttachmentDataKey: pngData, (NSString *)kQLPreviewPropertyMIMETypeKey: @"image/png"}; NSString *imgName = [[@(i++) stringValue] stringByAppendingPathExtension:@"png"]; - [htmlStr appendFormat:@"\t\t\t %@ %i\n", imgName, obj.name, obj.blockSize]; + [htmlStr appendFormat:@"\t\t\t %@ %i\n", imgName, obj.title, obj.blockSize]; htmlDict[imgName] = imgProps; continue; } @@ -135,7 +135,7 @@ static OSStatus GeneratePreviewForMemCard(void *thisInterface, QLPreviewRequestR NSDictionary *imgProps = @{(NSString *)kQLPreviewPropertyAttachmentDataKey: gifData, (NSString *)kQLPreviewPropertyMIMETypeKey: @"image/gif"}; NSString *imgName = [[@(i++) stringValue] stringByAppendingPathExtension:@"gif"]; - [htmlStr appendFormat:@"\t\t\t %@ %i\n", imgName, obj.name, obj.blockSize]; + [htmlStr appendFormat:@"\t\t\t %@ %i\n", imgName, obj.title, obj.blockSize]; htmlDict[imgName] = imgProps; } diff --git a/macosx/Pcsxr-QL/PSXMemEnumerator.m b/macosx/Pcsxr-QL/PSXMemEnumerator.m index 4cba0ef7..62ab396f 100644 --- a/macosx/Pcsxr-QL/PSXMemEnumerator.m +++ b/macosx/Pcsxr-QL/PSXMemEnumerator.m @@ -98,31 +98,31 @@ static void GetSoloBlockInfo(unsigned char *data, int block, McdBlock *Info) Info->Flags = *ptr; ptr += 0xa; - strlcpy(Info->ID, ptr, 12); + strlcpy(Info->ID, ptr, 13); ptr += 12; - strlcpy(Info->Name, ptr, 16); + strlcpy(Info->Name, ptr, 17); } static inline PCSXRMemFlag MemBlockFlag(unsigned char blockFlags) { if ((blockFlags & 0xF0) == 0xA0) { if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3) - return memFlagDeleted; + return PCSXRMemFlagDeleted; else - return memFlagFree; + return PCSXRMemFlagFree; } else if ((blockFlags & 0xF0) == 0x50) { if ((blockFlags & 0xF) == 0x1) - return memFlagUsed; + return PCSXRMemFlagUsed; else if ((blockFlags & 0xF) == 0x2) - return memFlagLink; + return PCSXRMemFlagLink; else if ((blockFlags & 0xF) == 0x3) - return memFlagEndLink; + return PCSXRMemFlagEndLink; } else - return memFlagFree; + return PCSXRMemFlagFree; //Xcode complains unless we do this... //NSLog(@"Unknown flag %x", blockFlags); - return memFlagFree; + return PCSXRMemFlagFree; } @@ -151,7 +151,7 @@ NSArray *CreateArrayByEnumeratingMemoryCardAtURL(NSURL *location) McdBlock memBlock; GetSoloBlockInfo((unsigned char *)memPtr, i + 1, &memBlock); - if (MemBlockFlag(memBlock.Flags) == memFlagFree) { + if (MemBlockFlag(memBlock.Flags) == PCSXRMemFlagFree) { //Free space: ignore i++; continue; @@ -170,7 +170,7 @@ NSArray *CreateArrayByEnumeratingMemoryCardAtURL(NSURL *location) }; PcsxrMemoryObject *obj = [[PcsxrMemoryObject alloc] initWithMcdBlock:&memBlock startingIndex:i size:x]; i += x; - if (MemBlockFlag(memBlock.Flags) == memFlagDeleted) { + if (MemBlockFlag(memBlock.Flags) == PCSXRMemFlagDeleted) { continue; } [memArray addObject:obj]; diff --git a/macosx/Psx-Memcard/GetMetadataForFile.m b/macosx/Psx-Memcard/GetMetadataForFile.m index 78adda93..afef4cfe 100644 --- a/macosx/Psx-Memcard/GetMetadataForFile.m +++ b/macosx/Psx-Memcard/GetMetadataForFile.m @@ -28,19 +28,19 @@ // //============================================================================== -typedef NS_ENUM(NSInteger, PCSXRMemFlags) { - memFlagDeleted, - memFlagFree, - memFlagUsed, - memFlagLink, - memFlagEndLink +typedef NS_ENUM(char, PCSXRMemFlags) { + PCSXRMemFlagDeleted = 0, + PCSXRMemFlagFree, + PCSXRMemFlagUsed, + PCSXRMemFlagLink, + PCSXRMemFlagEndLink }; static void GetSoloBlockInfo(unsigned char *data, int block, McdBlock *Info) { unsigned char *ptr = data + block * 8192 + 2; unsigned char *str = Info->Title; - unsigned char * sstr = Info->sTitle; + unsigned char *sstr = Info->sTitle; unsigned short c; int i, x = 0; @@ -103,31 +103,31 @@ static void GetSoloBlockInfo(unsigned char *data, int block, McdBlock *Info) Info->Flags = *ptr; ptr += 0xa; - strlcpy(Info->ID, ptr, 12); + strlcpy(Info->ID, ptr, 13); ptr += 12; - strlcpy(Info->Name, ptr, 16); + strlcpy(Info->Name, ptr, 17); } static inline PCSXRMemFlags MemBlockFlag(unsigned char blockFlags) { if ((blockFlags & 0xF0) == 0xA0) { if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3) - return memFlagDeleted; + return PCSXRMemFlagDeleted; else - return memFlagFree; + return PCSXRMemFlagFree; } else if ((blockFlags & 0xF0) == 0x50) { if ((blockFlags & 0xF) == 0x1) - return memFlagUsed; + return PCSXRMemFlagUsed; else if ((blockFlags & 0xF) == 0x2) - return memFlagLink; + return PCSXRMemFlagLink; else if ((blockFlags & 0xF) == 0x3) - return memFlagEndLink; + return PCSXRMemFlagEndLink; } else - return memFlagFree; + return PCSXRMemFlagFree; //Xcode complains unless we do this... //NSLog(@"Unknown flag %x", blockFlags); - return memFlagFree; + return PCSXRMemFlagFree; } Boolean GetMetadataForFile(void *thisInterface, CFMutableDictionaryRef attributes, CFStringRef contentTypeUTI, CFStringRef pathToFile) @@ -167,7 +167,7 @@ Boolean GetMetadataForFile(void *thisInterface, CFMutableDictionaryRef attribute GetSoloBlockInfo((unsigned char *)fileCData, i + 1, &memBlock); - if (MemBlockFlag(memBlock.Flags) == memFlagFree) { + if (MemBlockFlag(memBlock.Flags) == PCSXRMemFlagFree) { //Free space: ignore i++; continue; @@ -184,9 +184,9 @@ Boolean GetMetadataForFile(void *thisInterface, CFMutableDictionaryRef attribute break; } }; - // Ignore deleted blocks i += x; - if (MemBlockFlag(memBlock.Flags) == memFlagDeleted) { + // Ignore deleted blocks + if (MemBlockFlag(memBlock.Flags) == PCSXRMemFlagDeleted) { continue; } memCount++; diff --git a/macosx/Resources/Base.lproj/CheatWindow.xib b/macosx/Resources/Base.lproj/CheatWindow.xib index aa22f51d..05eb74b8 100644 --- a/macosx/Resources/Base.lproj/CheatWindow.xib +++ b/macosx/Resources/Base.lproj/CheatWindow.xib @@ -1,8 +1,8 @@ - + - + @@ -47,7 +47,7 @@ - + @@ -55,7 +55,7 @@ - + @@ -184,6 +184,7 @@ + @@ -223,7 +224,7 @@ - + @@ -231,7 +232,7 @@ - + @@ -352,6 +353,7 @@ Gw + diff --git a/macosx/Source/CheatController.m b/macosx/Source/CheatController.m index ebe73137..79dfb2c5 100644 --- a/macosx/Source/CheatController.m +++ b/macosx/Source/CheatController.m @@ -192,7 +192,7 @@ - (IBAction)closeCheatEdit:(id)sender { - [NSApp endSheet:editCheatWindow returnCode:[sender tag] == 1 ? NSCancelButton : NSOKButton]; + [[self window] endSheet:editCheatWindow returnCode:[sender tag] == 1 ? NSCancelButton : NSOKButton]; } - (IBAction)changeCheat:(id)sender diff --git a/macosx/Source/PcsxrMemCardArray.m b/macosx/Source/PcsxrMemCardArray.m index b7429f20..cf01e15b 100644 --- a/macosx/Source/PcsxrMemCardArray.m +++ b/macosx/Source/PcsxrMemCardArray.m @@ -103,7 +103,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str) McdBlock memBlock; GetMcdBlockInfo(carNum, i + 1, &memBlock); - if ([PcsxrMemoryObject memFlagsFromBlockFlags:memBlock.Flags] == memFlagFree) { + if ([PcsxrMemoryObject memFlagsFromBlockFlags:memBlock.Flags] == PCSXRMemFlagFree) { //Free space: ignore i++; continue; @@ -220,7 +220,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str) { int memSize = MAX_MEMCARD_BLOCKS; for (PcsxrMemoryObject *memObj in rawArray) { - if (memObj.flag != memFlagDeleted) { + if (memObj.flag != PCSXRMemFlagDeleted) { memSize -= memObj.blockSize; } } @@ -272,9 +272,9 @@ static inline void ClearMemcardData(char *to, int dsti, char *str) GetMcdBlockInfo(cardNumber, i+1, &baseBlock); PCSXRMemFlag theFlags = [PcsxrMemoryObject memFlagsFromBlockFlags:baseBlock.Flags]; - if (theFlags == memFlagDeleted || theFlags == memFlagFree) { + if (theFlags == PCSXRMemFlagDeleted || theFlags == PCSXRMemFlagFree) { PCSXRMemFlag up1Flags = theFlags; - while ((up1Flags == memFlagDeleted || up1Flags == memFlagFree) && x < MAX_MEMCARD_BLOCKS) { + while ((up1Flags == PCSXRMemFlagDeleted || up1Flags == PCSXRMemFlagFree) && x < MAX_MEMCARD_BLOCKS) { x++; McdBlock up1Block; GetMcdBlockInfo(cardNumber, x+1, &up1Block); @@ -300,7 +300,6 @@ static inline void ClearMemcardData(char *to, int dsti, char *str) - (void)deleteMemoryBlocksAtIndex:(int)slotnum { - int xor = 0, i, j; char *data, *ptr, *filename; if (cardNumber == 1) { filename = Config.Mcd1; @@ -321,8 +320,9 @@ static inline void ClearMemcardData(char *to, int dsti, char *str) McdBlock flagBlock; - for(i = theObj.startingIndex + 1; i < (theObj.startingIndex + theObj.blockSize + 1); i++) + for(int i = theObj.startingIndex + 1; i < (theObj.startingIndex + theObj.blockSize + 1); i++) { + char xor = 0; GetMcdBlockInfo(cardNumber, i, &flagBlock); ptr = data + i * 128; @@ -335,7 +335,7 @@ static inline void ClearMemcardData(char *to, int dsti, char *str) *ptr = 0xA0 | (flagBlock.Flags & 0xF); } else { continue; } - for (j = 0; j < 127; j++) xor ^= *ptr++; + for (unsigned char j = 0; j < 127; j++) xor ^= *ptr++; *ptr = xor; SaveMcd(filename, data, i * 128, 128); diff --git a/macosx/Source/PcsxrMemCardController.m b/macosx/Source/PcsxrMemCardController.m index 8f7bccd6..873303d8 100644 --- a/macosx/Source/PcsxrMemCardController.m +++ b/macosx/Source/PcsxrMemCardController.m @@ -115,7 +115,7 @@ int cardSize, freeConsBlocks, availBlocks; - if ([[fromCard memoryArray][selectedIndex] flag] == memFlagFree) { + if ([[fromCard memoryArray][selectedIndex] flag] == PCSXRMemFlagFree) { NSBeep(); return; } @@ -193,7 +193,7 @@ PcsxrMemoryObject *tmpObj = [curCard memoryArray][selectedIndex]; - if (tmpObj.flag == memFlagFree) { + if (tmpObj.flag == PCSXRMemFlagFree) { NSBeep(); return; } diff --git a/macosx/Source/PcsxrMemoryObject.h b/macosx/Source/PcsxrMemoryObject.h index 1223cd24..fd568199 100644 --- a/macosx/Source/PcsxrMemoryObject.h +++ b/macosx/Source/PcsxrMemoryObject.h @@ -10,11 +10,11 @@ #include "sio.h" typedef NS_ENUM(char, PCSXRMemFlag) { - memFlagDeleted, - memFlagFree, - memFlagUsed, - memFlagLink, - memFlagEndLink + PCSXRMemFlagDeleted, + PCSXRMemFlagFree, + PCSXRMemFlagUsed, + PCSXRMemFlagLink, + PCSXRMemFlagEndLink }; @interface PcsxrMemoryObject : NSObject diff --git a/macosx/Source/PcsxrMemoryObject.m b/macosx/Source/PcsxrMemoryObject.m index 9860e7fa..e8393608 100644 --- a/macosx/Source/PcsxrMemoryObject.m +++ b/macosx/Source/PcsxrMemoryObject.m @@ -22,32 +22,37 @@ @property (readwrite) BOOL hasImages; @end +#pragma pack(push,2) +struct PSXRGBColor { + UInt8 r; + UInt8 g; + UInt8 b; +}; +#pragma pack(pop) + @implementation PcsxrMemoryObject + (NSArray *)imagesFromMcd:(McdBlock *)block { NSMutableArray *imagesArray = [[NSMutableArray alloc] initWithCapacity:block->IconCount]; for (int i = 0; i < block->IconCount; i++) { - NSImage *memImage; - @autoreleasepool { - NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:16 pixelsHigh:16 bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bytesPerRow:0 bitsPerPixel:0]; - - short *icon = block->Icon; - - int x, y, c, v, r, g, b; - for (v = 0; v < 256; v++) { - x = (v % 16); - y = (v / 16); - c = icon[(i * 256) + v]; - r = (c & 0x001f) << 3; - g = ((c & 0x03e0) >> 5) << 3; - b = ((c & 0x7c00) >> 10) << 3; - [imageRep setColor:[NSColor colorWithCalibratedRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0] atX:x y:y]; - } - memImage = [[NSImage alloc] init]; - [memImage addRepresentation:imageRep]; - [memImage setSize:NSMakeSize(32, 32)]; + NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:16 pixelsHigh:16 bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bytesPerRow:16*3 bitsPerPixel:24]; + struct PSXRGBColor *cocoaImageData = (struct PSXRGBColor *)imageRep.bitmapData; + short *icon = block->Icon; + + for (int v = 0; v < 256; v++) { + int c = icon[(i * 256) + v]; + int r = (c & 0x001f) << 3; + int g = ((c & 0x03e0) >> 5) << 3; + int b = ((c & 0x7c00) >> 10) << 3; + struct PSXRGBColor *colorItem = &cocoaImageData[v]; + colorItem->r = r; + colorItem->g = g; + colorItem->b = b; } + NSImage *memImage = [[NSImage alloc] init]; + [memImage addRepresentation:imageRep]; + [memImage setSize:NSMakeSize(32, 32)]; [imagesArray addObject:memImage]; } return [NSArray arrayWithArray:imagesArray]; @@ -86,23 +91,23 @@ static NSString *MemLabelMultiSave; { switch (flagNameIndex) { default: - case memFlagFree: + case PCSXRMemFlagFree: return MemLabelFree; break; - case memFlagEndLink: + case PCSXRMemFlagEndLink: return MemLabelEndLink; break; - case memFlagLink: + case PCSXRMemFlagLink: return MemLabelLink; break; - case memFlagUsed: + case PCSXRMemFlagUsed: return MemLabelUsed; break; - case memFlagDeleted: + case PCSXRMemFlagDeleted: return MemLabelDeleted; break; } @@ -126,22 +131,22 @@ static NSString *MemLabelMultiSave; { if ((blockFlags & 0xF0) == 0xA0) { if ((blockFlags & 0xF) >= 1 && (blockFlags & 0xF) <= 3) - return memFlagDeleted; + return PCSXRMemFlagDeleted; else - return memFlagFree; + return PCSXRMemFlagFree; } else if ((blockFlags & 0xF0) == 0x50) { if ((blockFlags & 0xF) == 0x1) - return memFlagUsed; + return PCSXRMemFlagUsed; else if ((blockFlags & 0xF) == 0x2) - return memFlagLink; + return PCSXRMemFlagLink; else if ((blockFlags & 0xF) == 0x3) - return memFlagEndLink; + return PCSXRMemFlagEndLink; } else - return memFlagFree; + return PCSXRMemFlagFree; //Xcode complains unless we do this... NSLog(@"Unknown flag %x", blockFlags); - return memFlagFree; + return PCSXRMemFlagFree; } - (instancetype)initWithMcdBlock:(McdBlock *)infoBlock startingIndex:(uint8_t)startIdx size:(uint8_t)memSize @@ -150,7 +155,7 @@ static NSString *MemLabelMultiSave; self.startingIndex = startIdx; self.blockSize = memSize; self.flag = [PcsxrMemoryObject memFlagsFromBlockFlags:infoBlock->Flags]; - if (self.flag == memFlagFree) { + if (self.flag == PCSXRMemFlagFree) { self.imageArray = @[]; self.hasImages = NO; self.title = @"Free block"; @@ -279,23 +284,23 @@ static inline void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtc switch (flag) { default: - case memFlagFree: + case PCSXRMemFlagFree: return attribMemLabelFree; break; - case memFlagEndLink: + case PCSXRMemFlagEndLink: return attribMemLabelEndLink; break; - case memFlagLink: + case PCSXRMemFlagLink: return attribMemLabelLink; break; - case memFlagUsed: + case PCSXRMemFlagUsed: return attribMemLabelUsed; break; - case memFlagDeleted: + case PCSXRMemFlagDeleted: return attribMemLabelDeleted; break; } @@ -303,7 +308,7 @@ static inline void SetupAttrStr(NSMutableAttributedString *mutStr, NSColor *txtc - (BOOL)showCount { - if (flag == memFlagFree) { + if (flag == PCSXRMemFlagFree) { //Always show the size of the free blocks return YES; } else { diff --git a/macosx/Source/PcsxrPlugin.m b/macosx/Source/PcsxrPlugin.m index 09e3eecf..016aefff 100644 --- a/macosx/Source/PcsxrPlugin.m +++ b/macosx/Source/PcsxrPlugin.m @@ -242,20 +242,15 @@ #define PluginSymbolNameConfigure(type) PluginSymbolName(type, @"configure") #define PluginSymbolNameAbout(type) PluginSymbolName(type, @"about") -- (void)runCommand:(id)arg +- (void)runCommandNamed:(NSString*)arg { - @autoreleasepool { - NSString *funcName = arg[0]; - long (*func)(void); - - func = SysLoadSym(pluginRef, [funcName cStringUsingEncoding:NSASCIIStringEncoding]); - if (SysLibError() == NULL) { - func(); - } else { - NSBeep(); - } - - return; + long (*func)(void); + + func = SysLoadSym(pluginRef, [arg cStringUsingEncoding:NSASCIIStringEncoding]); + if (SysLibError() == NULL) { + func(); + } else { + NSBeep(); } } @@ -336,26 +331,24 @@ - (void)aboutAs:(int)aType { - NSArray *arg; - NSString *aboutSym = PluginSymbolNameAbout(aType); - arg = @[aboutSym, @0]; + //NSArray *arg = @[aboutSym, @0]; // detach a new thread - [NSThread detachNewThreadSelector:@selector(runCommand:) toTarget:self - withObject:arg]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [self runCommandNamed:aboutSym]; + }); } - (void)configureAs:(int)aType { - NSArray *arg; - NSString *configSym = PluginSymbolNameConfigure(aType); - arg = @[configSym, @1]; + //NSArray *arg = @[configSym, @1]; // detach a new thread - [NSThread detachNewThreadSelector:@selector(runCommand:) toTarget:self - withObject:arg]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [self runCommandNamed:configSym]; + }); } - (NSString *)displayVersion @@ -376,7 +369,7 @@ if (_name == nil) return [path lastPathComponent]; - return [NSString stringWithFormat:@"%@ %@ [%@]", self.name, [self displayVersion], [path lastPathComponent]]; + return [NSString stringWithFormat:@"%@ %@ [%@]", self.name, self.displayVersion, path.lastPathComponent]; } - (NSString*)debugDescription @@ -384,7 +377,7 @@ if (_name == nil) { return fullPlugPath; } - return [NSString stringWithFormat:@"%@, %@ [%@]", self.name, [self displayVersion], fullPlugPath]; + return [NSString stringWithFormat:@"%@, %@ [%@]", self.name, self.displayVersion, fullPlugPath]; } // the plugin will check if it's still valid and return the status diff --git a/macosx/pcsxr.pch b/macosx/pcsxr.pch index 4ed29cd8..eddc3eb9 100644 --- a/macosx/pcsxr.pch +++ b/macosx/pcsxr.pch @@ -11,7 +11,9 @@ // Apple deprecated __private_extern__ in Xcode 4.6. // This is a convenience declaration to retain the old behavior. +#ifndef __private_extern #define __private_extern __attribute__((visibility("hidden"))) +#endif #include #include diff --git a/plugins/dfinput/cfg-gtk.c b/plugins/dfinput/cfg-gtk.c index eba56d8a..5f26040f 100755 --- a/plugins/dfinput/cfg-gtk.c +++ b/plugins/dfinput/cfg-gtk.c @@ -61,7 +61,9 @@ const char *EmuKeyText[EMU_TOTAL] = { N_("Save state"), N_("Screenshot"), N_("Escape"), - N_("Rewind") + N_("Rewind"), + N_("Alt Speed 1"), + N_("Alt Speed 2") }; const char *DPadText[DKEY_TOTAL] = { diff --git a/plugins/dfinput/cfg.c b/plugins/dfinput/cfg.c index 2757bd74..f1d16673 100755 --- a/plugins/dfinput/cfg.c +++ b/plugins/dfinput/cfg.c @@ -126,6 +126,8 @@ static void SetDefaultConfig() { g.cfg.E.EmuDef[EMU_SCREENSHOT].EmuKeyEvent = XK_F8; g.cfg.E.EmuDef[EMU_ESCAPE].EmuKeyEvent = XK_Escape; g.cfg.E.EmuDef[EMU_REWIND].EmuKeyEvent = XK_BackSpace; + g.cfg.E.EmuDef[EMU_ALTSPEED1].EmuKeyEvent = XK_bracketleft; + g.cfg.E.EmuDef[EMU_ALTSPEED2].EmuKeyEvent = XK_bracketright; } void LoadPADConfig() { @@ -199,6 +201,16 @@ void LoadPADConfig() { g.cfg.E.EmuDef[EMU_REWIND].Mapping.Key = a; g.cfg.E.EmuDef[EMU_REWIND].Mapping.JoyEvType = b; g.cfg.E.EmuDef[EMU_REWIND].Mapping.J.d = c; + } else if (strncmp(buf, "EMU_ALTSPEED1=", 14) == 0) { + sscanf(buf, "EMU_ALTSPEED1=%d,%d,%d", &a, &b, &c); + g.cfg.E.EmuDef[EMU_ALTSPEED1].Mapping.Key = a; + g.cfg.E.EmuDef[EMU_ALTSPEED1].Mapping.JoyEvType = b; + g.cfg.E.EmuDef[EMU_ALTSPEED1].Mapping.J.d = c; + } else if (strncmp(buf, "EMU_ALTSPEED2=", 14) == 0) { + sscanf(buf, "EMU_ALTSPEED2=%d,%d,%d", &a, &b, &c); + g.cfg.E.EmuDef[EMU_ALTSPEED2].Mapping.Key = a; + g.cfg.E.EmuDef[EMU_ALTSPEED2].Mapping.JoyEvType = b; + g.cfg.E.EmuDef[EMU_ALTSPEED2].Mapping.J.d = c; } else if (strncmp(buf, "Select=", 7) == 0) { sscanf(buf, "Select=%d,%d,%d", &a, &b, &c); g.cfg.PadDef[current].KeyDef[DKEY_SELECT].Key = a; @@ -437,5 +449,13 @@ void SavePADConfig() { fprintf(fp, "EMU_REWIND=%d,%d,%d\n", g.cfg.E.EmuDef[EMU_REWIND].Mapping.Key, g.cfg.E.EmuDef[EMU_REWIND].Mapping.JoyEvType, g.cfg.E.EmuDef[EMU_REWIND].Mapping.J.d); + fprintf(fp, "EMU_ALTSPEED1=%d,%d,%d\n", + g.cfg.E.EmuDef[EMU_ALTSPEED1].Mapping.Key, + g.cfg.E.EmuDef[EMU_ALTSPEED1].Mapping.JoyEvType, + g.cfg.E.EmuDef[EMU_ALTSPEED1].Mapping.J.d); + fprintf(fp, "EMU_ALTSPEED2=%d,%d,%d\n", + g.cfg.E.EmuDef[EMU_ALTSPEED2].Mapping.Key, + g.cfg.E.EmuDef[EMU_ALTSPEED2].Mapping.JoyEvType, + g.cfg.E.EmuDef[EMU_ALTSPEED2].Mapping.J.d); fclose(fp); } diff --git a/plugins/dfinput/pad.h b/plugins/dfinput/pad.h index fb5ca718..7cd8eefe 100755 --- a/plugins/dfinput/pad.h +++ b/plugins/dfinput/pad.h @@ -121,6 +121,8 @@ enum { EMU_SCREENSHOT, EMU_ESCAPE, EMU_REWIND, + EMU_ALTSPEED1, + EMU_ALTSPEED2, EMU_TOTAL }; diff --git a/plugins/dfxvideo/draw.c b/plugins/dfxvideo/draw.c index 73d0fef8..3cc5e1c2 100755 --- a/plugins/dfxvideo/draw.c +++ b/plugins/dfxvideo/draw.c @@ -902,11 +902,10 @@ static XVisualInfo *myvisual; Display *display; static Colormap colormap; Window window; +Window overlay; static GC hGC; static XImage * Ximage; -static XvImage * XCimage; static XImage * XPimage=0; -char * Xpixels; char * pCaptionText; static int fx=0; @@ -949,15 +948,15 @@ void DestroyDisplay(void) XFreeGC(display,hGC); hGC = 0; } + if (overlay) + { + XDestroyWindow(display, overlay); + overlay = 0; + } if(Ximage) { XDestroyImage(Ximage); Ximage=0; - } - if(XCimage) - { - XFree(XCimage); - XCimage=0; } XShmDetach(display,&shminfo); @@ -1254,6 +1253,22 @@ void CreateDisplay(void) return; } + overlay=XCreateWindow(display,window, + iResX - 128,0,128,96, + 0,myvisual->depth, + InputOutput,myvisual->visual, + CWBorderPixel | CWBackPixel | + CWEventMask | CWDontPropagate | + CWColormap | CWCursor | CWEventMask, + &winattr); + + if(!overlay) + { + fprintf(stderr,"Failed in XCreateWindow()!!!\n"); + DestroyDisplay(); + return; + } + delwindow = XInternAtom(display,"WM_DELETE_WINDOW",0); XSetWMProtocols(display, window, &delwindow, 1); @@ -1352,14 +1367,6 @@ void CreateDisplay(void) else color = 0; - Xpixels = (char *)malloc(8*8*4); - for(i = 0; i < 8*8; ++i) - ((uint32_t *)Xpixels)[i] = color; - - XCimage = XvCreateImage(display,xv_port,xv_id, - (char *)Xpixels, 8, 8); - - /* Allocate max that could be needed: Big(est?) PSX res: 640x512 @@ -1676,6 +1683,7 @@ void DoBufferSwap(void) _w, _h, //dst w,h 1 ); + DisplayPic(); if(ulKeybits&KEY_SHOWFPS) //DisplayText(); c // paint menu text { @@ -1695,7 +1703,6 @@ void DoBufferSwap(void) XDrawImageString(display,window,hGC,2,13,szDispBuf,strlen(szDispBuf)); } - //if(XPimage) DisplayPic(); XFree(xvi); } @@ -1707,15 +1714,11 @@ void DoClearScreenBuffer(void) // CLEAR DX BUFFER XGetGeometry(display, window, &_dw, (int *)&_d, (int *)&_d, &_w, &_h, &_d, &_d); - XvPutImage(display, xv_port, window, hGC, XCimage, - 0, 0, 8, 8, 0, 0, _w, _h); //XSync(display,False); } void DoClearFrontBuffer(void) // CLEAR DX BUFFER {/* - XPutImage(display,window,hGC, XCimage, - 0, 0, 0, 0, iResX, iResY); XSync(display,False);*/ } @@ -1877,9 +1880,7 @@ void CreatePic(unsigned char * pMem) void DestroyPic(void) { if(XPimage) - { /* - XPutImage(display,window,hGC, XCimage, - 0, 0, 0, 0, iResX, iResY);*/ + { XDestroyImage(XPimage); XPimage=0; } @@ -1887,8 +1888,20 @@ void DestroyPic(void) void DisplayPic(void) { - XPutImage(display,window,hGC, XPimage, - 0, 0, iResX-128, 0,128,96); + static int mapped = 0; + if (XPimage) { + if (!mapped) { + XMapWindow(display, overlay); + mapped = 1; + } + XPutImage(display,overlay,hGC, XPimage, + 0,0, 0,0, 128,96); + } else { + if (mapped) { + XUnmapWindow(display, overlay); + mapped = 0; + } + } } void ShowGpuPic(void) diff --git a/plugins/dfxvideo/fps.c b/plugins/dfxvideo/fps.c index 2edcd30b..621c4963 100755 --- a/plugins/dfxvideo/fps.c +++ b/plugins/dfxvideo/fps.c @@ -36,8 +36,16 @@ BOOL bInitCap = TRUE; float fps_skip = 0; float fps_cur = 0; +float speed = 1; + #define MAXLACE 16 +void CALLBACK GPUsetSpeed(float newSpeed) { + if (newSpeed > 0 && newSpeed <= 1000) { + speed = newSpeed; + } +} + void CheckFrameRate(void) { if(UseFrameSkip) // skipping mode? @@ -74,6 +82,7 @@ void FrameCap (void) { static unsigned long curticks, lastticks, _ticks_since_last_update; static unsigned int TicksToWait = 0; + unsigned int frTicks = dwFrameRateTicks / speed; int overslept=0, tickstogo=0; BOOL Waiting = TRUE; @@ -86,10 +95,10 @@ void FrameCap (void) { lastticks = curticks; overslept = _ticks_since_last_update - TicksToWait; - if((_ticks_since_last_update-TicksToWait) > dwFrameRateTicks) + if((_ticks_since_last_update-TicksToWait) > frTicks) TicksToWait=0; else - TicksToWait=dwFrameRateTicks - overslept; + TicksToWait=frTicks - overslept; } else { @@ -104,7 +113,7 @@ void FrameCap (void) Waiting = FALSE; lastticks = curticks; overslept = _ticks_since_last_update - TicksToWait; - TicksToWait = dwFrameRateTicks - overslept; + TicksToWait = frTicks - overslept; return; } if (tickstogo >= 200 && !(dwActFixes&16)) @@ -123,6 +132,7 @@ void FrameSkip(void) static DWORD curticks, lastticks, _ticks_since_last_update; int tickstogo=0; static int overslept=0; + unsigned int frTicks = dwFrameRateTicks / speed; if(!dwLaceCnt) return; // important: if no updatelace happened, we ignore it completely @@ -146,12 +156,12 @@ void FrameSkip(void) curticks = timeGetTime(); // -> now we calc the time of the last drawn frame + the time we spent skipping _ticks_since_last_update= dwT+curticks - lastticks; - dwWaitTime=dwLastLace*dwFrameRateTicks; // -> and now we calc the time the real psx would have needed + dwWaitTime=dwLastLace*frTicks; // -> and now we calc the time the real psx would have needed if(_ticks_since_last_update we were too fast? { if((dwWaitTime-_ticks_since_last_update)> // -> some more security, to prevent - (60*dwFrameRateTicks)) // wrong waiting times + (60*frTicks)) // wrong waiting times _ticks_since_last_update=dwWaitTime; while(_ticks_since_last_update loop until we have reached the real psx time @@ -188,7 +198,7 @@ void FrameSkip(void) _ticks_since_last_update = curticks - lastticks; dwLastLace=dwLaceCnt; // store curr count (frame limitation helper) - dwWaitTime=dwLaceCnt*dwFrameRateTicks; // calc the 'real psx lace time' + dwWaitTime=dwLaceCnt*frTicks; // calc the 'real psx lace time' if (dwWaitTime >= overslept) dwWaitTime-=overslept; diff --git a/plugins/dfxvideo/gpu.c b/plugins/dfxvideo/gpu.c index 8e23be85..2ee92e78 100755 --- a/plugins/dfxvideo/gpu.c +++ b/plugins/dfxvideo/gpu.c @@ -2219,46 +2219,53 @@ void CALLBACK GPUgetScreenPic(unsigned char * pMem) // LINUX version: -extern char * Xpixels; - void GPUgetScreenPic(unsigned char * pMem) { -/* - unsigned short c;unsigned char * pf;int x,y; + unsigned char *pf=pMem; + unsigned char *buf, *line, *pD; - float XS=(float)iResX/128; - float YS=(float)iResY/96; - - pf=pMem; - memset(pMem, 0, 128*96*3); - - if(Xpixels) - { - unsigned char * ps=(unsigned char *)Xpixels; - { - long lPitch=iResX<<2; - uint32_t sx; - - for(y=0;y<96;y++) - { - for(x=0;x<128;x++) - { - sx=*((uint32_t *)((ps)+ - (((int)((float)y*YS))*lPitch)+ - ((int)((float)x*XS))*4)); - *(pf+0)=(sx&0xff); - *(pf+1)=(sx&0xff00)>>8; - *(pf+2)=(sx&0xff0000)>>16; - pf+=3; - } + int w = PreviousPSXDisplay.Range.x1, h = PreviousPSXDisplay.DisplayMode.y; + int x, y; + float XS = w / 128.0, YS = h / 96.0; + line = pf; + for (y = 0; y < 96; ++y) { + for (x = 0; x < 128; ++x) { + float r = 0, g = 0, b = 0, sr, sg, sb; + uint32_t cnt = 0, i, j; + for (j = 0; j < (int)((y+1)*YS) - (int)(y*YS); ++j) { + for (i = 0; i < (int)((x+1)*XS) - (int)(x*XS); ++i) { + pD = (unsigned char *)&psxVuw[(int)(y*YS + + PSXDisplay.DisplayPosition.y - 1 + j) * 1024 + + PSXDisplay.DisplayPosition.x] + + (PSXDisplay.RGB24 ? 3 : 2) * (int)(x*XS + i); + if (PSXDisplay.RGB24) { + uint32_t lu = *(uint32_t *)pD; + sr = RED(lu); + sg = GREEN(lu); + sb = BLUE(lu); + } else { + int32_t color = GETLE16(pD); + sr = (color << 3) & 0xf1; + sg = (color >> 2) & 0xf1; + sb = (color >> 7) & 0xf1; + } + r += sr * sr; + g += sg * sg; + b += sb * sb; + cnt += 1; + } + line[x * 3 + 2] = sqrt(r / cnt); + line[x * 3 + 1] = sqrt(g / cnt); + line[x * 3 + 0] = sqrt(b / cnt); } } + line += 128 * 3; } - ///////////////////////////////////////////////////////////////////// // generic number/border painter + unsigned short c; pf=pMem+(103*3); // offset to number rect for(y=0;y<20;y++) // loop the number rect pixel @@ -2289,7 +2296,6 @@ void GPUgetScreenPic(unsigned char * pMem) *(pf+(127*3))=0xff;*pf++=0xff; pf+=127*3; // offset to next line } -*/ } #endif diff --git a/plugins/peopsxgl/fps.c b/plugins/peopsxgl/fps.c index 32eeb4c6..5b9f7449 100755 --- a/plugins/peopsxgl/fps.c +++ b/plugins/peopsxgl/fps.c @@ -36,6 +36,7 @@ BOOL bIsPerformanceCounter=FALSE; float fFrameRateHz=0; +float speed=1; DWORD dwFrameRateTicks=16; float fFrameRate; int iFrameLimit; @@ -64,7 +65,9 @@ void FrameCap(void) { static unsigned long curticks, lastticks, _ticks_since_last_update; static unsigned long TicksToWait = 0; + double remTime; bool Waiting = TRUE; + DWORD frTicks=(DWORD)(dwFrameRateTicks / speed); { curticks = timeGetTime(); @@ -75,9 +78,9 @@ void FrameCap(void) { lastticks = curticks; - if((_ticks_since_last_update-TicksToWait) > dwFrameRateTicks) + if((_ticks_since_last_update-TicksToWait) > frTicks) TicksToWait=0; - else TicksToWait=dwFrameRateTicks-(_ticks_since_last_update-TicksToWait); + else TicksToWait=frTicks-(_ticks_since_last_update-TicksToWait); } else { @@ -85,13 +88,18 @@ void FrameCap(void) { curticks = timeGetTime(); _ticks_since_last_update = curticks - lastticks; + remTime = (TicksToWait - _ticks_since_last_update) * 1e6 / TIMEBASE; if ((_ticks_since_last_update > TicksToWait) || (curticks < lastticks)) { Waiting = FALSE; lastticks = curticks; - TicksToWait = dwFrameRateTicks; + TicksToWait = frTicks; } + else if (remTime > 2) + { + usleep(remTime - 2); + } } } } @@ -105,9 +113,15 @@ void FrameSkip(void) static int iNumSkips=0,iAdditionalSkip=0; // number of additional frames to skip static DWORD dwLastLace=0; // helper var for frame limitation static DWORD curticks, lastticks, _ticks_since_last_update; + DWORD frTicks=(DWORD)(dwFrameRateTicks / speed); + double remTime; + DWORD maxSkipTicks = 0; if(!dwLaceCnt) return; // important: if no updatelace happened, we ignore it completely + if (speed > 1) { + maxSkipTicks = 1/30. * TIMEBASE; + } if(iNumSkips) // we are in skipping mode? { dwLastLace+=dwLaceCnt; // -> calc frame limit helper (number of laces) @@ -128,23 +142,28 @@ void FrameSkip(void) curticks = timeGetTime(); _ticks_since_last_update= dwT+curticks - lastticks; - dwWaitTime=dwLastLace*dwFrameRateTicks; // -> and now we calc the time the real psx would have needed + dwWaitTime=dwLastLace*frTicks; // -> and now we calc the time the real psx would have needed if(_ticks_since_last_update we were too fast? { if((dwWaitTime-_ticks_since_last_update)> // -> some more security, to prevent - (60*dwFrameRateTicks)) // wrong waiting times + (60*frTicks)) // wrong waiting times _ticks_since_last_update=dwWaitTime; while(_ticks_since_last_update loop until we have reached the real psx time { // (that's the additional limitation, yup) + remTime = (dwWaitTime - _ticks_since_last_update) * 1e6 / TIMEBASE; + if (remTime > 2) { + usleep(remTime - 2); + } curticks = timeGetTime(); _ticks_since_last_update = dwT+curticks - lastticks; } } else // we were still too slow ?!!? { - if(iAdditionalSkip well, somewhen we really have to stop skipping on very slow systems + if(iAdditionalSkip well, somewhen we really have to stop skipping on very slow systems { iAdditionalSkip++; // -> inc our watchdog var dwLaceCnt=0; // -> reset lace count @@ -170,7 +189,7 @@ void FrameSkip(void) _ticks_since_last_update = curticks - lastticks; dwLastLace=dwLaceCnt; // store curr count (frame limitation helper) - dwWaitTime=dwLaceCnt*dwFrameRateTicks; // calc the 'real psx lace time' + dwWaitTime=dwLaceCnt*frTicks; // calc the 'real psx lace time' if(_ticks_since_last_update>dwWaitTime) // hey, we needed way too long for that frame... { @@ -194,6 +213,10 @@ void FrameSkip(void) while(_ticks_since_last_update 2) { + usleep(remTime - 2); + } curticks = timeGetTime(); _ticks_since_last_update = curticks - lastticks; } @@ -247,8 +270,8 @@ void calcfps(void) fps_cnt = 0; fps_tck = 1; - if(bUseFrameLimit && fps_cur>fFrameRateHz) // optical adjust ;) avoids flickering fps display - fps_cur=fFrameRateHz; + if(bUseFrameLimit && fps_cur>fFrameRateHz * speed) // optical adjust ;) avoids flickering fps display + fps_cur=fFrameRateHz * speed; } } @@ -267,7 +290,7 @@ void PCFrameCap (void) { Waiting = FALSE; lastticks = curticks; - TicksToWait = (TIMEBASE / (unsigned long)fFrameRateHz); + TicksToWait = (TIMEBASE / (unsigned long)(fFrameRateHz * speed)); } } } @@ -380,6 +403,12 @@ void CheckFrameRate(void) // called in updatelace ( } } +void CALLBACK GPUsetSpeed(float newSpeed) { + if (newSpeed > 0 && newSpeed <= 1000) { + speed = newSpeed; + } +} + void CALLBACK GPUsetframelimit(unsigned long option) // new EPSXE interface func: main emu can enable/disable fps limitation this way { bInitCap = TRUE; diff --git a/win32/pcsxr.rc b/win32/pcsxr.rc index abb6f806..02433f74 100755 --- a/win32/pcsxr.rc +++ b/win32/pcsxr.rc @@ -98,7 +98,7 @@ BEGIN CTEXT "PCSXR EMU\nVersion x.x",IDC_PCSXR_ABOUT_TEXT,22,10,112,15,0,WS_EX_TRANSPARENT CTEXT "PCSXR a psx emulator...",IDC_PCSXR_ABOUT_AUTHORS,10,35,135,63,0,WS_EX_TRANSPARENT CTEXT "Greets to...",IDC_PCSXR_ABOUT_GREETS,45,110,232,65 - CONTROL SPLASH_LOGO,IDC_STATIC,"Static",SS_BITMAP | WS_BORDER,155,10,171,101 + CONTROL 113,IDC_STATIC,"Static",SS_BITMAP | WS_BORDER,155,10,171,101 GROUPBOX "",IDC_STATIC,5,25,145,77 GROUPBOX "",IDC_STATIC,43,100,234,79 END @@ -350,16 +350,20 @@ END // remains consistent on all systems. IDI_APP_ICON ICON "gui\\pcsxr.ico" - ///////////////////////////////////////////////////////////////////////////// // // Bitmap // SPLASH_LOGO BITMAP "gui\\about.bmp" - MAIN_LOGO BITMAP "gui\\pcsxr.bmp" +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "gui\\pcsxr.exe.manifest" #endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/win32/pcsxr.vcxproj b/win32/pcsxr.vcxproj index 81893bf4..a03df972 100755 --- a/win32/pcsxr.vcxproj +++ b/win32/pcsxr.vcxproj @@ -55,6 +55,9 @@ + + false + _DEBUG;%(PreprocessorDefinitions)