Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping mode detection is always lorom #288

Open
spooonsss opened this issue Sep 8, 2023 · 0 comments
Open

Mapping mode detection is always lorom #288

spooonsss opened this issue Sep 8, 2023 · 0 comments
Labels

Comments

@spooonsss
Copy link
Contributor

The manual states "When no mapping mode is specified, Asar tries to determine the mapping mode from the output ROM." but it doesn't work.

Asar detects the mapping mode, then overwrites it with lorom.

>	asar.exe!setmapper() Line 110	C++
 	asar.exe!main(int argc, char * * argv) Line 360	C++
 	asar.exe!invoke_main() Line 79	C++
 	asar.exe!__scrt_common_main_seh() Line 288	C++
 	asar.exe!__scrt_common_main() Line 331	C++
 	asar.exe!mainCRTStartup(void * __formal) Line 17	C++
 	kernel32.dll!BaseThreadInitThunk�()	Unknown
 	ntdll.dll!RtlUserThreadStart�()	Unknown


>	asar.exe!initstuff() Line 689	C++
 	asar.exe!main(int argc, char * * argv) Line 417	C++
 	asar.exe!invoke_main() Line 79	C++
 	asar.exe!__scrt_common_main_seh() Line 288	C++
 	asar.exe!__scrt_common_main() Line 331	C++
 	asar.exe!mainCRTStartup(void * __formal) Line 17	C++
 	kernel32.dll!BaseThreadInitThunk�()	Unknown
 	ntdll.dll!RtlUserThreadStart�()	Unknown

Additionally, bigsa1rom isn't detected. I'd suggest setting it based on ROM size:

diff --git a/src/asar/main.cpp b/src/asar/main.cpp
index 0e49980..922988b 100644
--- a/src/asar/main.cpp
+++ b/src/asar/main.cpp
@@ -104,7 +104,14 @@ bool setmapper()
 	int romtypebyte=romdata[snestopc(0x00FFD6)];
 	if (mapper==lorom)
 	{
-		if (mapperbyte==0x23 && (romtypebyte==0x32 || romtypebyte==0x34 || romtypebyte==0x35)) mapper=sa1rom;
+		if (mapperbyte == 0x23 && (romtypebyte == 0x32 || romtypebyte == 0x34 || romtypebyte == 0x35))
+		{
+			mapper = sa1rom;
+			if (romlen >= 0x400000)
+			{
+				mapper = bigsa1rom;
+			}
+		}
 	}
 	return (maxscore>=0);
 }
@RPGHacker RPGHacker added the bug label Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants