Clock [Vega] - Printable Version +- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com) +-- Forum: Cheat Codes (https://mariokartwii.com/forumdisplay.php?fid=51) +--- Forum: Misc/Other (https://mariokartwii.com/forumdisplay.php?fid=55) +--- Thread: Clock [Vega] (/showthread.php?tid=1194) |
Clock [Vega] - Vega - 08-02-2019 Clock [Vega] NOTE: It's recommended to also include this code to eliminate frame flickers -> https://mkwii.com/showthread.php?tid=1530 This code will place a graphical image of the current time (hours:minutes) on the bottom of your screen. It is reliant on the time set in the Calendar settings of the Wii's settings. So make sure the time in Calendar is up to date. The clock is always on once you go past the bootstrap screen (the Wii Remote warnings). It is in military format (13:00 is 1:00 PM) NOTE: This code makes use of memory addresses 0x80000F98 thru 0x80000FBF. Make sure no other codes in your GCT/Cheat-Manager are using those addresses. NTSC-U C200A3F0 00000007 9421FF80 BC610008 806DA358 80630044 80630000 3D808002 618C23E0 7D8803A6 4E800021 B8610008 38210080 80010014 60000000 00000000 C2009640 00000011 9421FF80 BC610008 3FE08002 3FA0801A 63BCACBC 7F8803A6 4E800021 3F608000 637B0F98 7F65DB78 63BCAF08 7F8803A6 4E800021 48000011 25303264 3A253032 64000000 7CC802A6 80FB0008 811B0004 38600089 388000D8 38A00001 63FE1DF0 7FC803A6 4E800021 63FE1DD0 7FC803A6 4E800021 B8610008 38210080 81830000 60000000 00000000 PAL C200A430 00000007 9421FF80 BC610008 806DA360 80630044 80630000 3D808002 618C2480 7D8803A6 4E800021 B8610008 38210080 80010014 60000000 00000000 C2009680 00000011 9421FF80 BC610008 3FE08002 3FA0801A 63BCAD5C 7F8803A6 4E800021 3F608000 637B0F98 7F65DB78 63BCAFA8 7F8803A6 4E800021 48000011 25303264 3A253032 64000000 7CC802A6 80FB0008 811B0004 38600089 388000D8 38A00001 63FE1E90 7FC803A6 4E800021 63FE1E70 7FC803A6 4E800021 B8610008 38210080 81830000 60000000 00000000 NTSC-J C200A38C 00000007 9421FF80 BC610008 806DA360 80630044 80630000 3D808002 618C23A0 7D8803A6 4E800021 B8610008 38210080 80010014 60000000 00000000 C20095DC 00000011 9421FF80 BC610008 3FE08002 3FA0801A 63BCAC7C 7F8803A6 4E800021 3F608000 637B0F98 7F65DB78 63BCAEC8 7F8803A6 4E800021 48000011 25303264 3A253032 64000000 7CC802A6 80FB0008 811B0004 38600089 388000D8 38A00001 63FE1DB0 7FC803A6 4E800021 63FE1D90 7FC803A6 4E800021 B8610008 38210080 81830000 60000000 00000000 NTSC-K C200A538 00000007 9421FF80 BC610008 806DA380 80630044 80630000 3D808002 618C24E0 7D8803A6 4E800021 B8610008 38210080 80010014 60000000 00000000 C2009788 00000011 9421FF80 BC610008 3FE08002 3FA0801A 63BCB0B8 7F8803A6 4E800021 3F608000 637B0F98 7F65DB78 63BCB304 7F8803A6 4E800021 48000011 25303264 3A253032 64000000 7CC802A6 80FB0008 811B0004 38600089 388000D8 38A00001 63FE1EF0 7FC803A6 4E800021 63FE1ED0 7FC803A6 4E800021 B8610008 38210080 81830000 60000000 00000000 Code creator: Vega Code credits: Star (Draw Text), RiiDefi (Draw Text), Megazig (OS Functions) 1st ASM (When Game loads StaticR.rel, Get Render Mode & Call Direct Print Setup Frame Buffer) #~~~~~~~~~~~~~~~~# # START ASSEMBLY # #~~~~~~~~~~~~~~~~# # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Register Notes: # # No need to backup r0 or LR # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~# #~~~~~~~~~~~~~~~~~~~~~# # Macros & Statements # #~~~~~~~~~~~~~~~~~~~~~# .macro push_stack stwu r1, -0x80 (r1) stmw r3, 0x8 (r1) .endm .macro pop_stack lmw r3, 0x8 (r1) addi r1, r1, 0x80 .endm .macro call_link address lis r12, \address@h ori r12, r12, \address@l mtlr r12 blrl .endm .macro default_instruction lwz r0, 0x0014 (r1) .endm .set region, '' #Must set region value, or else source will not compile .if (region == 'E' || region == 'e') # RMCE .set nw4r_db_DirectPrint_SetupFB, 0x800223E0 .elseif (region == 'P' || region == 'p') # RMCP .set nw4r_db_DirectPrint_SetupFB, 0x80022480 .elseif (region == 'J' || region == 'j') # RMCJ .set nw4r_db_DirectPrint_SetupFB, 0x800223A0 .elseif (region == 'K' || region == 'k') # RMCK .set nw4r_db_DirectPrint_SetupFB, 0x800224E0 .else # Invalid Region .abort .endif #~~~~~~~~~~~~~~~~~~~~~~~# # Start Register Safety # #~~~~~~~~~~~~~~~~~~~~~~~# push_stack #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Get Render Mode (RKSystem->mpVideo()->pRenderMode) # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# .if (region == 'E' || region == 'e') # RMCE lwz r3, -0x5CA8(r13) .elseif (region == 'P' || region == 'p') # RMCP lwz r3, -0x5CA0(r13) .elseif (region == 'J' || region == 'j') # RMCJ lwz r3, -0x5CA0(r13) .elseif (region == 'K' || region == 'k') # RMCK lwz r3, -0x5C80(r13) .endif lwz r3, 0x0044(r3) lwz r3, 0x0 (r3) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Call nw4r::db: DirectPrint_SetupFB # # r3 = Render Mode # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# call_link nw4r_db_DirectPrint_SetupFB #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # End Register Safety; Default Instruction # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# pop_stack default_instruction # #~~~~~~~~~~~~~~# # END ASSEMBLY # #~~~~~~~~~~~~~~# ========== 2nd ASM (Calculate the Time, Draw it to Screen) #~~~~~~~~~~~~~~~~# # START ASSEMBLY # #~~~~~~~~~~~~~~~~# # #~~~~~~~~~~~~~~~~~~~~~~# # Register Notes: # #~~~~~~~~~~~~~~~~~~~~~~# #No need to backup r0 or LR #~~~~~~~~~~~~~~~~~~~~~# # Macros & Statements # #~~~~~~~~~~~~~~~~~~~~~# .macro push_stack stwu r1, -0x80 (r1) stmw r3, 0x8 (r1) .endm .macro pop_stack lmw r3, 0x8 (r1) addi r1, r1, 0x80 .endm .macro call_nw4r address ori r30, r31, \address@l mtlr r30 blrl .endm .macro call_os address ori r28, r29, \address@l mtlr r28 blrl .endm .set region, '' #Must set region value, or else source will not compile .if (region == 'E' || region == 'e') # RMCE .set nw4r_db_DirectPrint_Printf, 0x1DF0 .set nw4r_db_DirectPrint_StoreCache, 0x1DD0 .set OSGetTime, 0xACBC .set OSTicksToCalendarTime, 0xAF08 .elseif (region == 'P' || region == 'p') # RMCP .set nw4r_db_DirectPrint_Printf, 0x1E90 .set nw4r_db_DirectPrint_StoreCache, 0x1E70 .set OSGetTime, 0xAD5C .set OSTicksToCalendarTime, 0xAFA8 .elseif (region == 'J' || region == 'j') # RMCJ .set nw4r_db_DirectPrint_Printf, 0x1DB0 .set nw4r_db_DirectPrint_StoreCache, 0x1D90 .set OSGetTime, 0xAC7C .set OSTicksToCalendarTime, 0xAEC8 .elseif (region == 'K' || region == 'k') # RMCK .set nw4r_db_DirectPrint_Printf, 0x1EF0 .set nw4r_db_DirectPrint_StoreCache, 0x1ED0 .set OSGetTime, 0xB0B8 .set OSTicksToCalendarTime, 0xB304 .else # Invalid Region .abort .endif #~~~~~~~~~~~~# # Push Stack # #~~~~~~~~~~~~# push_stack #~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Set r31 and r29 for Macros # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~# lis r31, 0x8002 lis r29, 0x801A #~~~~~~~~~~~~~~~~~~~~~~~~~# # OSGetTime # # No Args # # Return Values... # # r3 = Upper Time Base # # r4 = Lower Time Base # #~~~~~~~~~~~~~~~~~~~~~~~~~# call_os OSGetTime #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Setup Exception Vector for Real Time Dump # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# lis r27, 0x8000 ori r27, r27, 0x0F98 mr r5, r27 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # OSTicksToCalendarTime # # r3 = Upper Time Base # # r4 = Lower Time Base # # r5 = Where to dump full Real Time to # # r5 + 0 = Where Seconds are Dumped # # r5 + 4 = Minutes Dumped # # r5 + 8 = Hours Dumped # # r5 + 0xC = Day # # r5 + 0x10 = Month # # r5 + 0x14 = Year # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# call_os OSTicksToCalendarTime #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Set C++ String and r6 Arg of DirectPrint # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# bl set_string .string "%02d:%02d\0\0" set_string: mflr r6 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Grab Hours then Seconds for printf args of DirectPrint # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# lwz r7, 0x8 (r27) lwz r8, 0x4 (r27) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # DirectPrint Printf & Store Cache # # Purpose: Draw on Screen # # r3 = X coordinate (starts far left) # # r4 = Y coordinate (starts at very top) # # r5 = 0 No Wrap; 1 Wrap # # r6 = Address Pointer to String that will be Drawn on Screen # # r7 thru r10 printf format args # # f1 thru f13 printf float format args # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# li r3, 0x89 li r4, 0xD8 li r5, 0x1 call_nw4r nw4r_db_DirectPrint_Printf call_nw4r nw4r_db_DirectPrint_StoreCache #~~~~~~~~~~~# # Pop Stack # #~~~~~~~~~~~# pop_stack lwz r12, 0 (r3) #Default Instruction # #~~~~~~~~~~~~~~# # END ASSEMBLY # #~~~~~~~~~~~~~~# RE: Clock , in progress - JoshuaMK - 08-03-2019 Random question, but does the DirectPrint method have flickering issues on a real wii? What about in multiplayer? RE: Clock , in progress - Vega - 08-03-2019 It flickers cause both Frame Buffers aren't set up. Star and Rii tried resolving this problem but were not successful. I'm using the DirectPrint in this code so i can run this while running Star's speedometer (which uses YS's easy extender to put the graphic on the screen). EDIT: Code appears complete. It compiles. Second ASM is C0 codetype. But if you wanna test this, I recommend making the 2nd ASM the shared item code address for step by step testing in Dolphin. RE: Clock , in progress - JoshuaMK - 08-03-2019 Now i wanna try and figure it out lol. A non flickering graphic would be nice. RE: Clock , in progress - Vega - 08-03-2019 You could always use YS's Easy Extender. Take a look at the graphical speedometer code made by Star (http://mkwii.com/showthread.php?tid=911) Take a look at the source that is using the universal meter address. It takes the speed, uses a sprintf function, then draws it to screen using what YS had in his original Easy Extender. There's a couple of small typos on Star's source. Pushing the rtoc on the stack, and 'fabs r1, r1' (suppose to be f1 f1). I imagine the compiler sees that error and still compiles it correctly. UPDATE Small edits to source. Compiled code and test. It is working 100%. All i gotta do is move the graphical to the center. I could trim down the code a bit by allocating more stack space and using that to dump the real time there, but i'll just stick to the exception vectors. RE: Clock , in progress - JoshuaMK - 08-03-2019 Good job. Will look into it. RE: Clock - Vega - 08-03-2019 UPDATE 2: Code finished! Moved to codes forum |