// Title            : Dr.Hell's Action Replay GPU Wrapper
// Version          : 1.03
// Copyright        : (C)Dr.Hell, 2002
// Web              : http://members.tripod.co.jp/DrHell/
// Language         : Delphi 2.0
// Compressed by    : UPX 1.2
// Thanks(alphabet) : 501XX, Iori


My pen name is 'Dr.Hell' in English or 'Ɠcn' in Japanese.
I live in Nippon(true name of Japan) and I cannot write English well.
Please guess.

{͉̕ɂ܂B


Introduction
------------
This is a cheat tool for PSX emulator with PSEmu Pro type GPU plugin.


How to use (ex. ePSXe)
----------------------
(1) Move "gpuDHAR.dll" and "CODES" folder into plugins folder of ePSXe.

(2) Start ePSXe.

(3) Click [main menu->config->video].

(3) Select "Dr.Hell's Action Replay GPU Wrapper" as Video Plugin.

(4) Click "Configure" button.

(5) Select a true video plugin and configure.

(6) Input cheat codes.

    1) copy and paste
    2) drag and drop a text file
    3) double click on the editor to paste from registry

(7) Select a code engine.

  'Standard' engine supports part of 'Caetla' codes.
  'PAR Compatible' engine supports "(Pro) Action Replay" codes.

    "Action Replay" is a product of DATEL in UK.
    Its look is modified and it is called another name in another country,
    for example, "Game Shark" in US.

(8) Choose a trigger, UpdateLace(checked) or DmaChain(not checked).

(9) Set Skip Count.

(A) (Not Necessary)Input base address and check 'Set Base Address'.
  If not checked, base address is automatically determined.

(B) When you want to activate codes at the time of a game start,
check 'Activate Codes'.

(C) Click "OK" button.

(D) Click "OK" button.

(E) Restart ePSXe and start a game.

(F) When ESC button is pushed(GPUclose is called),
 codes are activated/inactivated alternatively.
(A state of codes(active/inactive) is written to registry)

(G) When a game is continued(GPUopen is called),
codes and a state of codes(active/inactive) are reloaded from registry.


Cheat codes supported
---------------------

"Standard" engine supports part of "caetla" codes as follows.
+------------------------------------------------------------------------------+
|  3aaaaaaa 00dd     : Write simply ( 8 Bit)                                   |
|  8aaaaaaa dddd     : Write simply (16 Bit)                                   |
|  9aaaaaaa dddddddd : Write simply (32 Bit)                                   |
|  Blllaaaa dddddddd : Repeat(with 3, 8 and 9 code)                            |
|  Caaaaaaa 00dd     : Ignore one following code if not equal ( 8 Bit)         |
|  Daaaaaaa dddd     : Ignore one following code if not equal (16 Bit)         |
|  Eaaaaaaa ddddllll : Ignore several following codes if not equal (16 Bit)    |
+------------------------------------------------------------------------------+

"PAR compatible" engine supports following codes.
+------------------------------------------------------------------------------+
|  30aaaaaa 00dd : Write simply ( 8 Bit)                                       |
|  80aaaaaa dddd : Write simply (16 Bit)                                       |
|  10aaaaaa dddd : Increase (16 Bit)                                           |
|  11aaaaaa dddd : Decrease (16 Bit)                                           |
|  20aaaaaa 00dd : Increase ( 8 Bit)                                           |
|  21aaaaaa 00dd : Decrease ( 8 Bit)                                           |
|  5000llaa dddd : Repeat(with 30 and 80 code)                                 |
|  D0aaaaaa dddd : Ignore until next single-code if not equal   (16 Bit)       |
|  D1aaaaaa dddd : Ignore until next single-code if equal       (16 Bit)       |
|  D2aaaaaa dddd : Ignore until next single-code if not less    (16 Bit)       |
|  D3aaaaaa dddd : Ignore until next single-code if not greater (16 Bit)       |
|  E0aaaaaa 00dd : Ignore until next single-code if not equal   ( 8 Bit)       |
|  E1aaaaaa 00dd : Ignore until next single-code if equal       ( 8 Bit)       |
|  E2aaaaaa 00dd : Ignore until next single-code if not less    ( 8 Bit)       |
|  E3aaaaaa 00dd : Ignore until next single-code if not greater ( 8 Bit)       |
|  C0aaaaaa dddd : Ignore all following codes if not equal(Master Code)        |
|  C2aaaaaa 0lll : Copy bytes                                                  |
+------------------------------------------------------------------------------+
Single-code means 30,80,10,11,20,21 codes.

 aa... address [to add (the following)] 
 dd... data [to add (the following)]
 ll... loop number or lines to jump 


Registry used
-------------
"Software\Vision Thing\PSEmu Pro\GPU\DHAR"

BaseAddr    4 // Base address(0=Automatic)
Codes    1024 // Translated codes(must be null-terminated and max 127 codes).
Engine      4 // Type of code engine(1=PAR compatible, Other=Standard)
LibName   256 // GPU file name to wrap
Skip        4 // Skip count
Switch      4 // A state of codes(active/inactive)
Trigger     4 // Trigger for patch(1=UpdateLace, Other=DmaChain)


Update
------

1.03(02/07/16)
A function to change a state of codes(active/inactive)
 at the time of a game start was added.
Timing of reloading codes from registry was changed(GPUclose -> GPUopen).

1.02a(02/07/14)
SendCode.exe was updated.
(1)Interfaces for selecting codes were changed to CheckBox type.
(When ScrollBox is double-clicked, CheckBoxes are reversed.)
(2)"CODELIST.TXT(not need CODEINDX.TXT)" for cep/CVGSUtil was supported.
(CODLIST.TXT and SendCode.exe have to be in the same folder.)

1.02(2002/07/09)
a function to reload codes from registry was added for changing codes during execution.
SendCode.exe which was a support application to send codes to registry was added.

1.01(2002/06/30)
A function to activate/deactivate codes was added.

1.0(2002/06/30)
1st release.


Reference
---------
P.E.Op.S. Soft GPU 1.5


Written in Japanese..


͂߂
--------
PSEmuProvOC^Cv̉c[łB
̂Ɋ̓vOC^CṽvCXe[VG~[^Ɍ肳܂B
GPŨbp[^CvȂ̂ŕʓr{GPUKvłB
P̂ŊĂ镪A^̓nhOǂ̂ł͂Ȃł傤B

WXgăR[hn̂ŁA
R[hf[^x[XɂẮAʃAvP[Vɂ񋟂ɂȂƎv܂B
܂AT[`ɃVrAȃXs[h͗vȂ̂ŁA
T[`@\͕t܂(cepg܂傤)B
قڊ`ƎvĉB


g(. ePSXe)
-----------------
(1) "gpuDHAR.dll"  "CODES" tH_ ePSXe  "plugins" tH_ɈړB

(2) ePSXe NB

(3) main menu   config  video NbNB

(3) Video Plugin Ƃ "Dr.Hell's Action Replay GPU Wrapper" IB

(4) "Configure" NbNB

(5) {(bv)vOCIAݒsB

(6) R[h͂B

  ͕@
    1) Rs[y[Xg
    2) R[heLXgt@CɋLqāAhbv
    3) ̏_uNbN (WXgy[Xg)

  Open _CAOgăR[hǂ݂񂾏ꍇAX^[gɍĂ
  Configure IƁAGPUݒ肪悤łB

(7) R[hGWIB

  'Standard' ... Caetla R[hp
  'PAR Compatible' ... PAR R[hp

(8) gK[ɂăpb`s߂B

  j^[̑gK[ɂꍇ́A`FbNB

(9) pb`̕px̂߃XLbvݒ肷B

(A) x[XAhX͂B

  ʏ͓͂ȂČ\łB
  0ɂ邩A`FbNOƁAIɎ擾܂B

(B) Q[JñR[h̃I^Itݒ肷

(C) "OK" NbNB

(D) "OK" NbNB

(E) ePSXeċNAQ[JnB

(F) ESC{^(GPUcloseĂ΂)ɃR[hI^ItB
(I^Itݒ肪WXgɏ܂)

(G) Q[ĊJ(GPUopenĂ΂ꂽ)
WXgR[h̃I^ItݒƃR[hă[hB


gpWXg
--------------
"Software\Vision Thing\PSEmu Pro\GPU\DHAR"

BaseAddr    4 // x[XAhXwB0(nil/NULL)Ŏ擾B
Codes    1024 // R[hi[obt@̂́B
Engine      4 // R[hGW̎(WPAR)B
LibName   256 // bvdllt@CB
Skip        4 // pb`̃XLbvB
Switch      4 // R[h̃I^ItݒB
Trigger     4 // pb`sgK[̎ށB


XV
--------

1.03(02/07/16)
Q[JñR[h̃I^ItݒǉB
WXg̃R[hă[h̃^C~OύXB
ɔSendCode.exeɂR[h̃I^ItݒǉB

1.02(2002/07/09)
ESC{^ɃWXgR[hă[h悤ύX
WXgւ̃R[hM[eBeBƂSendCode.exeYt

1.01(2002/06/30)
ESC{^ɃR[hIEIt悤ύX

1.0(2002/06/30)
t@[Xg[X


Ql
--------
P.E.Op.S. Soft GPU 1.5
Iorȉ

GNX|[g(written in Delphi)

// PSEmu Pro Native

    PSEgetLibType:    function: DWORD; stdcall;                           // 01
    PSEgetLibName:    function: PChar; stdcall;                           // 02
    PSEgetLibVersion: function: DWORD; stdcall;                           // 03
    GPUinit:          function: Integer; stdcall;                         // 04
    GPUshutdown:      function: Integer; stdcall;                         // 05
    GPUopen:          function(p1: THandle): Integer; stdcall;            // 06
    GPUclose:         function: Integer; stdcall;                         // 07
    GPUconfigure:     function: Integer; stdcall;                         // 08
    GPUabout:         procedure; stdcall;                                 // 09
    GPUtest:          function: Integer; stdcall;                         // 10
    GPUwriteData:     procedure(p1: DWORD); stdcall;                      // 11
    GPUwriteStatus:   procedure(p1: DWORD); stdcall;                      // 12
    GPUreadData:      function: DWORD; stdcall;                           // 13
    GPUreadStatus:    function: DWORD; stdcall;                           // 14
    GPUdmaChain:      function(p1: PDWORD; p2: DWORD): Integer; stdcall;  // 15
    GPUgetMode:       function: Integer; stdcall;                         // 16
    GPUsetMode:       procedure(p1: DWORD); stdcall;                      // 17
    GPUupdateLace:    procedure; stdcall;                                 // 18

// Additives for ePSXe

    GPUmakeSnapshot:  procedure; stdcall;                                 // 19
    GPUwriteDataMem:  procedure(p1: PDWORD; p2: Integer); stdcall;        // 20
    GPUreadDataMem:   procedure(p1: PDWORD; p2: Integer); stdcall;        // 21
    GPUdisplayText:   procedure(p1: PChar); stdcall;                      // 22
    GPUdisplayFlags:  procedure(p1: DWORD); stdcall;                      // 23
    GPUfreeze:        function(p1: DWORD; p2: Pointer):Integer; stdcall;  // 24
    GPUshowScreenPic: procedure(p1: PByte); stdcall;                      // 25
    GPUgetScreenPic:  procedure(p1: PByte); stdcall;                      // 26

// Additives for FPSE (Not Supported)

    GPU_Update:       procedure; stdcall;                                 // 27
    GP1_Read:         function: DWORD; stdcall;                           // 28
    GP0_Read:         function: DWORD; stdcall;                           // 29
    GP0_Write:        procedure(p1: DWORD); stdcall;                      // 30
    GP1_Write:        procedure(p1: DWORD); stdcall;                      // 31
    GPU_Open:         function(p1: PDWORD): DWORD; stdcall;               // 32
    GPU_Close:        procedure; stdcall;                                 // 33
    GPU_ScreenShot:   procedure(p1: PChar); stdcall;                      // 34
    GPU_DmaExec:      procedure(p1, p2, p3: DWORD); stdcall;              // 35
    GPU_Configure:    function(p1: PDWORD): Integer; stdcall;             // 36
    GPU_LoadState:    procedure(p1: Pointer); stdcall;                    // 37
    GPU_SaveState:    procedure(p1: Pointer); stdcall;                    // 38
    GPU_About:        procedure(p1: PDWORD); stdcall;                     // 39

