Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: Core/Common/Src/PluginVideo.cpp
- ===================================================================
- --- Core/Common/Src/PluginVideo.cpp (revision 3626)
- +++ Core/Common/Src/PluginVideo.cpp (working copy)
- @@ -29,6 +29,7 @@
- Video_ExitLoop = 0;
- Video_Screenshot = 0;
- Video_AddMessage = 0;
- + Video_AccessEFB = 0;
- Video_Prepare = reinterpret_cast<TVideo_Prepare>
- (LoadSymbol("Video_Prepare"));
- @@ -44,6 +45,8 @@
- (LoadSymbol("Video_ExitLoop"));
- Video_AddMessage = reinterpret_cast<TVideo_AddMessage>
- (LoadSymbol("Video_AddMessage"));
- + Video_AccessEFB = reinterpret_cast<TVideo_AccessEFB>
- + (LoadSymbol("Video_AccessEFB"));
- if ((Video_Prepare != 0) &&
- (Video_SendFifoData != 0) &&
- @@ -51,7 +54,8 @@
- (Video_EnterLoop != 0) &&
- (Video_ExitLoop != 0) &&
- (Video_Screenshot != 0) &&
- - (Video_AddMessage != 0))
- + (Video_AddMessage != 0) &&
- + (Video_AccessEFB != 0))
- validVideo = true;
- }
- Index: Core/Common/Src/PluginVideo.h
- ===================================================================
- --- Core/Common/Src/PluginVideo.h (revision 3626)
- +++ Core/Common/Src/PluginVideo.h (working copy)
- @@ -30,6 +30,7 @@
- typedef void (__cdecl* TVideo_EnterLoop)();
- typedef void (__cdecl* TVideo_ExitLoop)();
- typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds);
- +typedef u32 (__cdecl* TVideo_AccessEFB)(EFBAccessType, u32, u32);
- class PluginVideo : public CPlugin
- {
- @@ -43,6 +44,7 @@
- TVideo_EnterLoop Video_EnterLoop;
- TVideo_ExitLoop Video_ExitLoop;
- TVideo_UpdateXFB Video_UpdateXFB;
- + TVideo_AccessEFB Video_AccessEFB;
- TVideo_AddMessage Video_AddMessage;
- TVideo_Screenshot Video_Screenshot;
- Index: Core/Core/Src/HW/MemmapFunctions.cpp
- ===================================================================
- --- Core/Core/Src/HW/MemmapFunctions.cpp (revision 3626)
- +++ Core/Core/Src/HW/MemmapFunctions.cpp (working copy)
- @@ -21,6 +21,7 @@
- #include "WII_IOB.h"
- #include "../Core.h"
- #include "../PowerPC/PowerPC.h"
- +#include "../PluginManager.h"
- namespace Memory
- {
- @@ -35,8 +36,8 @@
- 80322df8: or r0, r3, r0 a |= x;
- 80322dfc: rlwinm r0, r0, 0, 10, 7 (ff3fffff) a &= 0xff3fffff
- 80322e00: oris r3, r0, 0x0040 x = a | 0x00400000
- -80322e04: lwz r0, 0 (r3)
- -80322e08: stw r0, 0 (r5)
- +80322e04: lwz r0, 0 (r3) r0 = *r3
- +80322e08: stw r0, 0 (r5) z =
- 80322e0c: blr
- */
- @@ -125,15 +126,14 @@
- {
- if (em_address < 0xcc000000)
- {
- - // TODO: glReadPixels :p
- - _var = 0;
- -
- int x = (em_address & 0xfff) >> 2;
- int y = (em_address >> 12) & 0x3ff;
- if (em_address & 0x00400000) {
- - DEBUG_LOG(MEMMAP, "EFB Z Read @ %i, %i", x, y);
- + _var = CPluginManager::GetInstance().GetVideo()->Video_AccessEFB(EFBAccessType::PEEK_Z, x, y);
- + DEBUG_LOG(MEMMAP, "EFB Z Read @ %i, %i\t= %i", x, y, _var);
- } else {
- - DEBUG_LOG(MEMMAP, "EFB Color Read @ %i, %i", x, y);
- + _var = CPluginManager::GetInstance().GetVideo()->Video_AccessEFB(EFBAccessType::PEEK_COLOR, x, y);
- + DEBUG_LOG(MEMMAP, "EFB Color Read @ %i, %i\t= %i", x, y, _var);
- }
- }
- else if (em_address <= 0xcc009000)
- @@ -203,8 +203,10 @@
- int x = (em_address & 0xfff) >> 2;
- int y = (em_address >> 12) & 0x3ff;
- if (em_address & 0x00400000) {
- + CPluginManager::GetInstance().GetVideo()->Video_AccessEFB(EFBAccessType::POKE_Z, x, y);
- DEBUG_LOG(MEMMAP, "EFB Z Write %08x @ %i, %i", data, x, y);
- } else {
- + CPluginManager::GetInstance().GetVideo()->Video_AccessEFB(EFBAccessType::POKE_COLOR, x, y);
- DEBUG_LOG(MEMMAP, "EFB Color Write %08x @ %i, %i", data, x, y);
- }
- return;
- Index: Plugins/Plugin_VideoOGL/Src/main.cpp
- ===================================================================
- --- Plugins/Plugin_VideoOGL/Src/main.cpp (revision 3626)
- +++ Plugins/Plugin_VideoOGL/Src/main.cpp (working copy)
- @@ -458,3 +458,35 @@
- }
- }
- +u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y)
- +{
- + switch (type)
- + {
- + case EFBAccessType::PEEK_Z:
- + {
- + u32 z = 0;
- + TRectangle source, scaledTargetSource;
- + ComputeBackbufferRectangle(&source);
- + source.Scale(Renderer::GetTargetScaleX(), Renderer::GetTargetScaleY(), &scaledTargetSource);
- + GLuint depth_tex = Renderer::ResolveAndGetDepthTarget(scaledTargetSource);
- + glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, &z);
- + GL_REPORT_ERRORD();
- + return z;
- + }
- + break;
- +
- + case EFBAccessType::POKE_Z:
- + break;
- +
- + case EFBAccessType::PEEK_COLOR:
- + break;
- +
- + case EFBAccessType::POKE_COLOR:
- + break;
- +
- + default:
- + break;
- + }
- + return 0;
- +}
- +
- Index: PluginSpecs/pluginspecs_video.h
- ===================================================================
- --- PluginSpecs/pluginspecs_video.h (revision 3626)
- +++ PluginSpecs/pluginspecs_video.h (working copy)
- @@ -23,6 +23,14 @@
- typedef void (*TUpdateFPSDisplay)(const char* text); // sets the window title
- typedef void (*TKeyPressed)(int keycode, bool shift, bool control); // sets the window title
- +enum EFBAccessType
- +{
- + PEEK_Z = 0,
- + POKE_Z,
- + PEEK_COLOR,
- + POKE_COLOR
- +};
- +
- typedef struct
- {
- // fifo registers
- @@ -113,6 +121,13 @@
- EXPORT void CALL Video_UpdateXFB(u32 _dwXFBAddr, u32 _dwWidth, u32 _dwHeight, s32 _dwYOffset, bool scheduling);
- // __________________________________________________________________________________________________
- +// Function: Video_AccessEFB
- +// input: type of access (r/w, z/color, ...), x coord, y coord
- +// output: response to the access request (ex: peek z data at specified coord)
- +//
- +EXPORT u32 CALL Video_AccessEFB(EFBAccessType type, u32 x, u32 y);
- +
- +// __________________________________________________________________________________________________
- // Function: Video_Screenshot
- // input: Filename
- // output: TRUE if all was okay
Add Comment
Please, Sign In to add comment