Language…
5 users online: Astrakitu, cletus_deletus,  Donut, GRIMMKIN, RPG Hacker - Guests: 246 - Bots: 375
Users: 64,795 (2,376 active)
Latest user: mathew

How do I check the current level through RAM?

I want to make some kind of patch that requires level number (so it only applies on a certain level). I know everything else except how to find the current level. Searching "current level" on the RAM map only shows up a Lunar Magic address.
UberASM and many other patches install a hack which stores the current level number into $010B. If you don't use any of them, here is one you can patch to your ROM:
Code
!addr			= $0000

if read1($00FFD5) == $23
	sa1rom
	!addr			= $6000
endif

!level	= $010B|!addr

ORG $05D8B7
	BRA +
	NOP #3		;the levelnum patch goes here in many ROMs, just skip over it
+
	REP #$30
	LDA $0E		
	STA !level
	ASL		
	CLC		
	ADC $0E		
	TAY		
	LDA.w $E000,Y
	STA $65		
	LDA.w $E001,Y
	STA $66		
	LDA.w $E600,Y
	STA $68		
	LDA.w $E601,Y
	STA $69		
	BRA +
ORG $05D8E0
	+