MasterGear
MasterGear emulates Sega Master System, Sega Game Gear, Sega SG-1000 and 2 more systems. It reads 8 files, 1 of them required: without a required file it does not start games. A required file is needed only by the machines that use it. Each file below cites the line of source code that reads it.
About this profile
Technical notes
Sega 8bit emulator by Marat Fayzullin, covering Mark3, MasterSystem, MasterSystem 2, GameGear, SG1000, the keyboard-equipped SC3000 and the disk-based SF7000. Two builds of version 4.9 were read. The Android package com.fms.mg is sold on Google Play and not carried on the author's site, so it came from a mirror. That copy has versionName 4.9, versionCode 4900, sha256 11c3f3331d6774739c11dfd604f74f545a17ceba3feb7fb294f02bd80943af35, md5 2cb4df11254f8525e0a2253677450555, and is accepted because its v1 certificate is the author's own key, CN=Marat Fayzullin O=Garage Research issued 2011, fingerprint d09469e9b550cbc9005d3bd089f3df5f0ba89cba71cdd3b33736a0382d6f9848, beside a Play distribution source stamp in the signing block. The free MG 4.9 builds for Windows and Ubuntu, published by the author, were read next to it and open the same files. The native libraries keep their symbol tables, so the Android readings below cite libmain.so offsets in the x86_64 slice, and the arm64-v8a, armeabi-v7a, armeabi and x86 slices carry the same filename set. No source has been published: every MG download on the site is a binary package, while ColEm and fMSX on the same site ship source archives. ref: MG-Android-4900.apk META-INF/CERT.RSA, https://fms.komkon.org/MG/, MG49-Windows-bin.zip, MG49-Ubuntu-x86-bin.tgz (sha256 25c8a0de74ed6eda, mg sha256 2d6b714cdbd4e6bd)
SF7000.ROM is the only system ROM either binary names, and it is read through the cartridge loader. ResetSMS loads it whenever the requested hardware becomes SF7000. LoadROM returning zero makes ResetSMS clear the SF7000 bits and restore the previous hardware, so LoadDSK finds the machine still is not an SF7000, ejects the image and fails, logging "Failed switching into SF7000 mode." when verbose output is on. Nothing about the file is checked: the size comes from a seek to the end, is rounded up to the first power of two of at least 16kB, and the buffer is filled with FFh before the read, so a short image is padded rather than refused. When bit 15 of the mode word is set, a successful load is followed by patching the image at eight fixed addresses, 0008h, 0010h, 0018h, 0020h, 0028h, 0030h, 107Ch and 10F8h, with an EDh FEh C9h trap and a checksum byte. ref: libmain.so ResetSMS 0x435a0-0x43b0d (LoadROM 0x43604, revert 0x4367d, patch loop 0x43619-0x4367b), LoadROM 0x43c80-0x4451a (open 0x43db3, size 0x43dfa-0x43f1a, read 0x43f4f), LoadDSK 0x46db0-0x46ecb, MG49-Ubuntu-x86-bin mg 0x3d0fd-0x3d124, 0x3c330 (0x3ca58)
The other machines open no system file. SF7000.ROM is the only system ROM name in either binary, and the desktop build references it once, from the SF7000 branch of the reset routine, so MasterSystem, GameGear, SG1000 and SC3000 start straight into the cartridge. The SC3000 BASIC arrives as a cartridge like any other program: the packaged title database keys Basic 2.10 and Basic 3.10 by cartridge CRC32 under the SC3000 heading. ref: MG49-Ubuntu-x86-bin mg 0x3d0fd (sole reference to SF7000.ROM at 0x5231a), libmain.so ResetSMS 0x43604, assets/names.dat
On Android one directory holds everything. MainActivity hands EMULib.k() to jniStart, which copies it into the buffer GetHomeDir returns and passes that same buffer to SetPrivateDir. Every open goes through mopen, then OpenRealFile, which tries the name as given and again as <PrivateDir>/<basename>, keeping the larger of the two when both open. That directory is external storage joined with the application label up to its first space, so /sdcard/MasterGear, falling back to getExternalFilesDirs(null) when it is not a writable directory, and the cheat archive the author publishes writes the same path out in full. The desktop builds have no such directory and open every name where they stand. Every one of these opens ends in zlib, mopen handing the descriptor OpenRealFile returned to gzdopen while the disk loader and the desktop builds call gzopen straight, so each file also opens gzipped, and on Android a content:// name is routed to the Android storage framework instead. ref: MainActivity.java:2265-2276, EMULib.java:456, 494-553, 688-698, libmain.so jniStart 0x18bb0-0x193e1 (0x1921c, 0x1926c), SetPrivateDir 0x38f80, OpenRealFile 0x39190-0x393c3, mopen 0x393d0-0x3959d, LoadFDI 0x558f7, MasterGear-Cheats.zip ROOT.chts
8 files: 1 required, 7 optional. 2 more files come with the app.
By kind: 1 BIOS and 9 game data.
In this collection: 3 in repo, 0 missing and 5 unsourceable.
Required
Section titled “Required”| File | Status |
|---|---|
SF7000.ROMSF7000 IPL, read into the cartridge window before the machine starts
Source
|
required for Sega SF-7000 in repo |
Game data
Section titled “Game data”| File | Status |
|---|---|
MasterGear-Cheats.zipcheat database read by the Cheatopedia browser
Source
|
optional in repo game data |
custom.chtsuser cheat sets added to the Cheatopedia menu
Source
|
optional unsourceable game data |
Controls.pngvirtual joystick skin
Source
|
optional in repo game data |
Backdrop.pngbackdrop drawn around the emulated screen
Source
|
optional unsourceable game data |
<game>.back.pngbackdrop for one title
Source
|
optional unsourceable game data |
<game>.ipsIPS patch applied to the loaded cartridge
Source
|
optional unsourceable game data |
<name>.chtcheat codes loaded from the file selector
Source
|
optional unsourceable game data |
Comes with the app
Section titled “Comes with the app”| File | Status | Hash |
|---|---|---|
names.dattitle database keyed by system and CRC32
Hashes and source
|
game data | SHA1 15f93bd7b0e5 |
changelog.htmlrelease history shown from the Android menu
Hashes and source
|
game data | SHA1 fbd74bab1bda |
Next steps
Section titled “Next steps”- Get the files, for the setup in use
- Every system, and the files each one needs
- When a game does not start