Code Type 0x3: Start/End Loop with:

cjwine

New Member
OP
Newbie
Joined
May 20, 2021
Messages
2
Trophies
0
Age
40
XP
225
Country
China
hi guy how to use

Code Type 0x3: Start/End Loop with:​

040B0000 04A1DF78 00010001
040B0000 04A1DFA8 00020001
040B0000 04A1DFD8 00030001
040B0000 04A1E008 00040001
040B0000 04A1E038 00050001
040B0000 04A1E068 00060001
040B0000 04A1E098 00070001
040B0000 04A1E0C8 00080001
040B0000 04A1E0F8 00090001
040B0000 04A1E128 000A0001
040B0000 04A1E158 000B0001
040B0000 04A1E188 000C0001
040B0000 04A1E1B8 000D0001
040B0000 04A1E1E8 000E0001
040B0000 04A1E218 000F0001

i am not lazy。 my english is not good and There is no example for reference I've been stuck for several days
 

masagrator

The patches guy
Developer
Joined
Oct 14, 2018
Messages
6,296
Trophies
3
XP
12,067
Country
Poland
I guess they want to make it shorter, because addresses and values are using the same pattern across all lines.

So it would look i think like this
Python:
40010000 00000000 04A1DF78 # Load to R1 value 04A1DF78
40020000 00000000 00010001 # Load to R2 value 00010001
30030000 0000000F # Loop block start, with iterations set to 15
A4210300 # Write last 4 bytes from R2 to address [MAIN + R1]
94011100 00000030 # To 4 bytes of R1 add 00000030 and result store in R1
94022100 00010000 # To 4 bytes of R2 add 00010000 and result store in R2
31030000 # Loop block end
 
Last edited by masagrator,
  • Like
Reactions: cjwine

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,348
Country
United Kingdom
If it is a simple thing then spreadsheets should do that well enough (convert hex to decimal, add whatever shift you want from column or whatever, turn decimal back).

If it is a more involved thing then you have two general approaches.

Some approaches will allow you to include an additional offset within the cheat format. You can set this addition to be what you want.
Otherwise you might be into something called slide codes, these being used more for setting a whole range of related addresses to something else (set all items in inventory to 99, set all party health to full when you have 20 party members and don't want 20 lines of cheat when it is better written as make these addresses say 999, there are 20 of them and they are all say 10 bytes apart) but could also be twisted to this if you wanted to do a particularly short loop..
Looking at
https://github.com/Atmosphere-NX/Atmosphere/blob/master/docs/features/cheats.md

type 0x5 and 0xA cheats said:

Code Type 0x5: Load Register with Memory Value​

Code type 0x5 allows loading a value from memory into a register, either using a fixed address or by dereferencing the destination register.

Load From Fixed Address Encoding​

5TMR00AA AAAAAAAA

  • T: Width of memory read (1, 2, 4, or 8 bytes).
  • M: Memory region to write to (0 = Main NSO, 1 = Heap, 2 = Alias, 3 = Aslr).
  • R: Register to load value into.
  • A: Immediate offset to use from memory region base.

Load from Register Address Encoding​

5T0R10AA AAAAAAAA

  • T: Width of memory read (1, 2, 4, or 8 bytes).
  • R: Register to load value into. (This register is also used as the base memory address).
  • A: Immediate offset to use from register R.


Code Type 0xA: Store Register to Memory Address​


Code type 0xA allows writing a register to memory.


Encoding​


ATSRIOxa (aaaaaaaa)


  • T: Width of memory write (1, 2, 4, or 8 bytes).
  • S: Register to write to memory.
  • R: Register to use as base address.
  • I: Increment register flag (0 = do not increment R, 1 = increment R by T).
  • O: Offset type, see below.
  • x: Register used as offset when O is 1, Memory type when O is 3, 4 or 5.
  • a: Value used as offset when O is 2, 4 or 5.

Offset Types​


  • 0: No Offset
  • 1: Use Offset Register
  • 2: Use Fixed Offset
  • 3: Memory Region + Base Register
  • 4: Memory Region + Relative Address (ignore address register)
  • 5: Memory Region + Relative Address + Offset Register

and the rest of the document you don't have a particularly easy way to add a further offset beyond the one included (compared to something like https://doc.kodewerx.org/hacking_nds.html ) without rejigging the codes somewhat and frankly I would not really expect it owing to the way the Switch works compared to older consoles.

You do however have mathematical operations in such cheat codes, type 0x9 there being the currently suggested one but there is also type 0x7 that some in the past might have used.

Anyway
580F0000 06027470
5 means grab value from memory and stick it in register
8 means grab 8 bytes
0 means use the main NSO memory region (there are different regions with different purposes and isolated portions as this is more modern security than a lot of older systems).
F means put the data you grab in register F
00 means you are doing fixed address encoding (as opposed to using a register as a source for where you want to go)
The remaining data ( 00 06027470, probably usually written more as 0000 0602 7470) is where in memory to actually go.

You wanting to turn that last 0 into an 8 in your example (not sure why, could be different region, could be the next character in the list, could be instead do it for player 2, could be update to the game changed the layout marginally... it could matter but for this I am going with no).
Multiple approaches if simply using a spreadsheet is not going to cut it (code makers tend to organise code formats this way to allow for easier editing like this compared to burying addresses deep within the code and making the maths more annoying)
You could turn the code from fixed to register based, add a code before then to set the register, add 8 (or whatever) to it and go from there. Long winded but doable enough.
Slide codes if this is going to be for more then would involve setting up a 0x3 and some arithmetic, but you could also do it with 0x1 and 0x2 and some arithmetic.
For this I hope you have the basics of code loops. Any coding tutorial will give you this ( https://www.tutorialspoint.com/cprogramming/c_loops.htm , I don't any for Japanese if you would prefer but again almost any computer language will have this and probably refer back to the English terms anyway as most computer languages are made with that in mind).
 

FtiWgSdDFKUCUrjHyo9c

Active Member
Newcomer
Joined
Apr 30, 2022
Messages
36
Trophies
0
Age
35
Location
HYOGO
XP
715
Country
Japan
I'm sorry my bad wrote that.
I make item copy code but to many code line.
I want to shorten the code.

For example
08100000 06027470 00000000
78000000 00000008

This code adds +8h to the address 06027470, right?

I want to copy the address by reference.
So i want to do the same thing with Code Type 0x5 and Code Type 0xA addresses.
 

FtiWgSdDFKUCUrjHyo9c

Active Member
Newcomer
Joined
Apr 30, 2022
Messages
36
Trophies
0
Age
35
Location
HYOGO
XP
715
Country
Japan
I want to shorten this code.
Makai Senki Disgaea 5 (JP) v1.0.3
TID:0100E5F0000C0000
BID:48F474F4A87011D3

[item copy 01 to 02]
580F0000 06027470
A8F00400 060276C8
580F0000 06027478
A8F00400 060276D0
580F0000 06027480
A8F00400 060276D8
580F0000 06027488
A8F00400 060276E0
580F0000 06027490
A8F00400 060276E8
580F0000 06027498
A8F00400 060276F0
580F0000 060274A0
A8F00400 060276F8
580F0000 060274A8
A8F00400 06027700
580F0000 060274B0
A8F00400 06027708
580F0000 060274B8
A8F00400 06027710
580F0000 060274C0
A8F00400 06027718
580F0000 060274C8
A8F00400 06027720
580F0000 060274D0
A8F00400 06027728
580F0000 060274D8
A8F00400 06027730
580F0000 060274E0
A8F00400 06027738
580F0000 060274E8
A8F00400 06027740
580F0000 060274F0
A8F00400 06027748
580F0000 060274F8
A8F00400 06027750
580F0000 06027500
A8F00400 06027758
580F0000 06027508
A8F00400 06027760
580F0000 06027510
A8F00400 06027768
580F0000 06027518
A8F00400 06027770
580F0000 06027520
A8F00400 06027778
580F0000 06027528
A8F00400 06027780
580F0000 06027530
A8F00400 06027788
580F0000 06027538
A8F00400 06027790
580F0000 06027540
A8F00400 06027798
580F0000 06027548
A8F00400 060277A0
580F0000 06027550
A8F00400 060277A8
580F0000 06027558
A8F00400 060277B0
580F0000 06027560
A8F00400 060277B8
580F0000 06027568
A8F00400 060277C0
580F0000 06027570
A8F00400 060277C8
580F0000 06027578
A8F00400 060277D0
580F0000 06027580
A8F00400 060277D8
580F0000 06027588
A8F00400 060277E0
580F0000 06027590
A8F00400 060277E8
580F0000 06027598
A8F00400 060277F0
580F0000 060275A0
A8F00400 060277F8
580F0000 060275A8
A8F00400 06027800
580F0000 060275B0
A8F00400 06027808
580F0000 060275B8
A8F00400 06027810
580F0000 060275C0
A8F00400 06027818
580F0000 060275C8
A8F00400 06027820
580F0000 060275D0
A8F00400 06027828
580F0000 060275D8
A8F00400 06027830
580F0000 060275E0
A8F00400 06027838
580F0000 060275E8
A8F00400 06027840
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: https://www.youtube.com/watch?v=rn4vARy44iY