Sloth- Posted April 27, 2018 Share Posted April 27, 2018 (edited) I have these codes 3DMarkers.cpp and 3DMarkers.h (thanks to @The Hero), and i was trying to compile them, but looks like there still could be some missing info: First of all: I'll asume that uint8, uint16, int16 and uint32 (that doesn't appear by default in my enviroment as declared) can be defined as: typedef unsigned char uint8;typedef unsigned short uint16;typedef signed short int16;typedef unsigned int uint32; Here i had to make following changes: *(uint8*)0x8D5D8B = 0xD1; // cone marker alpha uint8 coneMarkerAlpha = *(uint8*)0x8D5D8B;coneMarkerAlpha = 0xD1; // cone marker alpha Because compiler doesn't like the first expression. And i guess i can change this: InjectHook(0x7269FA, C3dMarkers::Init); // original codepatch::RedirectCall(0x7269FA, C3dMarkers::Init); // my changePatch<BYTE>(0x585CCB, MARKER_SET_COLOR_B); // original codepatch::Set<BYTE>(0x585CCB, MARKER_SET_COLOR_B); // my changeInjectHook(0x72576B, &C3dMarkerSizeHack, PATCH_CALL); // original codepatch::RedirectCall(0x7269FA, C3dMarkerSizeHack); // my changeInjectHook(0x440F38, EnexMarkersColorBreak, PATCH_JUMP); // original codepatch::RedirectJump(0x440F38, EnexMarkersColorBreak); // my changeNop(0x72563A, 6); // original codepatch::Nop(0x72563A, 6); // my change But i don't know what is this: Patch(0x7232C1, &C3dMarkers::m_pRpClumpArray[0]); Maybe: patch::Set<UnknownType>(0x7232C1, &C3dMarkers::m_pRpClumpArray[0]); And there is still some other stuff that i don't know how to fix: WRAPPER RpClump *C3dMarkers::LoadMarker(const char *name) { WRAPARG(name); EAXJMP(0x722810); }//WRAPPER appears as undefined And in here: CCoronas::RegisterCorona((uint32)marker, NULL, marker->m_color.red, marker->m_color.green, marker->m_color.blue, 0x84, *marker->m_mat.GetPos(), 1.2*marker->m_fSize, TheCamera.LODDistMultiplier * 50.0f, gpCoronaTexture[1], 0, 0, 0, 0, 0.0, false, 1.5f, false, 255, false, true);// *marker->m_mat.GetPos() // CMatrix C3DMarker::m_mat // CMatrix doesn't have a member called GetPos()// TheCamera.LODDistMultiplier // The compiler from Code::Blocks suggest me to change "LODDistMultiplier" by "m_fLODDistMultiplier" RwFrame *f = RpAtomicGetFrame(marker->m_pAtomic);// RpAtomicGetFrame() is not defined Thanks in advance. Edited April 27, 2018 by Sloth- Link to comment Share on other sites More sharing options...
Juarez Posted April 28, 2018 Share Posted April 28, 2018 (edited) patch::Set<UnknownType>(0x7232C1, &C3dMarkers::m_pRpClumpArray[0]); I Think should be. patch::SetPointer(0x7232C1, &C3dMarkers::m_pRpClumpArray[0]); //WRAPPER appears as undefined Just use an define: #define WRAPPER __declspec(naked) // *marker->m_mat.GetPos() // CMatrix C3DMarker::m_mat // CMatrix doesn't have a member called GetPos() GetPos() pos // RpAtomicGetFrame() is not defined Replace the your code with: RwFrame *f = (RwFrame *)marker->m_pAtomic->object.object.parent); Edited April 28, 2018 by juarez Sloth- 1 Link to comment Share on other sites More sharing options...
Sloth- Posted April 28, 2018 Author Share Posted April 28, 2018 Thank you very much! It helped a lot. But there are another missing stuff: WRAPARG(name); EAXJMP(0x722810);//undefined WRAPARG and EAXJMP CMatrix mat(m_mat.pMatrix);// m_mat doesn't have a member called "pMatrix" The closest member i could find is "m_mat.m_pAttachMatrix", but it seems to be incompatible (RwMatrix*). RwFrameUpdateObjects(RpClumpGetFrame(m_pAtomic));// RpClumpGetFrame() not definedRpAtomicRender(m_pAtomic);// RpAtomicRender() not defined And also there is this: static StaticPatcher Patcher([](){ // All the patch instructions});// StaticPatcher unknown But i guess i can change it to this: static void InstallPatches() { // All the code}class My3DMarkers {public: My3DMarkers() { InstallPatches(); }} My3DMarkers; Or maybe: class My3DMarkers {public: static void InstallPatches { // All the code } My3DMarkers() { InstallPatches(); }} My3DMarkers; But there is one error anyways: patch::RedirectCall(0x7250B1, &C3dMarker::Render); // argument of type "void (C3dMarker::*)()" is not compatible with parameter of type void * Looks like if i redefine C3dMarker::Render as static, error dissapears but all the "C3dMarker" properties inside C3dMarker::Render() cannot be called inside a static method. Link to comment Share on other sites More sharing options...
Juarez Posted April 28, 2018 Share Posted April 28, 2018 (edited) //undefined WRAPARG and EAXJMP #define WRAPARG(a) UNREFERENCED_PARAMETER(a)#define EAXJMP(a) { _asm mov eax, a _asm jmp eax } CMatrix mat(m_mat.pMatrix); // m_mat doesn't have a member called "pMatrix" https://github.com/aap/skygfx/blob/10c0232b83305b89779cf3cc0aac7d3ce2993358/src/neo.h So yep, you can use m_pAttachMatrix RwFrameUpdateObjects(RpClumpGetFrame(m_pAtomic)); // RpClumpGetFrame() not defined RpClump != RpAtomic, RpClump have one or mulit RpAtomic. RpAtomicRender(m_pAtomic); // RpAtomicRender() not defined m_pAtomic->renderCallBack(m_pAtomic); patch::RedirectCall(0x7250B1, &C3dMarker::Render); Another trick to patching thiscall: inline __declspec(naked) void* MemberFuncToPtr(...) { __asm mov eax, [esp+4]__asm retn}void* ptr;ptr = MemberFuncToPtr(&C3dMarker::Render);CPatch::RedirectJump(0x7250B1, ptr); Or if the above code will doesn't work use: void __fastcall C3dMarker_Render(C3dMarker* pMarker, int edx0){pMarker->Render();}CPatch::RedirectJump(0x7250B1, C3dMarker_Render); Edited April 28, 2018 by juarez Sloth- 1 Link to comment Share on other sites More sharing options...
Sloth- Posted April 28, 2018 Author Share Posted April 28, 2018 So the last stuff my code lacks is this: RwFrameUpdateObjects(RpClumpGetFrame(m_pAtomic)); Sorry, no idea about what to do with this. Looks like RpClumpGetFrame() was removed or changed into another method, but i have no clue about that. Link to comment Share on other sites More sharing options...
Juarez Posted April 28, 2018 Share Posted April 28, 2018 RwFrameUpdateObjects(RpClumpGetFrame(m_pAtomic)); RwFrameUpdateObjects(RpClumpGetFrame((RwFrame *)pAtomic->object.object.parent)); Now it's should work Sloth- 1 Link to comment Share on other sites More sharing options...
Sloth- Posted April 28, 2018 Author Share Posted April 28, 2018 (edited) Sorry, i still lack RpClumpGetFrame() definition. Where i can find it? Edited April 28, 2018 by Sloth- Link to comment Share on other sites More sharing options...
Juarez Posted April 28, 2018 Share Posted April 28, 2018 (edited) #define RpClumpGetFrame(_clump) ((RwFrame *) rwObjectGetParent(_clump))#define rwObjectGetParent(object) (((const RwObject *)(object))->parent) Edited April 28, 2018 by juarez Sloth- 1 Link to comment Share on other sites More sharing options...
Sloth- Posted April 28, 2018 Author Share Posted April 28, 2018 (edited) Thanks a lot man! Strange stuff: Doing this: RwFrameUpdateObjects(RpClumpGetFrame((RwFrame *)m_pAtomic->object.object.parent)); Makes game crash, but this don't: RwFrameUpdateObjects(RpClumpGetFrame(m_pAtomic)); I'll study this code deeply because the resizing of arrow markers and spheres is doing fine but the rotation isn't ocurring. Thanks again. I hope to release the asi once finished. ---- EDIT: release will wait a long time. Code is harder to fix than i though. I don't know assembler and even original author of the code, who i contacted to ask for help, finds this code really confusing, and he lacks of time. Gladly i could study assembler, trouble is: currently i don't have time, i'll be busy. Edited May 1, 2018 by Sloth- Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now