Initial alpha release

This commit is contained in:
ezwrk 2024-09-29 14:42:34 +03:00
commit e62e34e862
22 changed files with 2762 additions and 0 deletions

15
License.md Normal file
View file

@ -0,0 +1,15 @@
*This project is licensed under MIT.*
Copyright (c) 2024 4aiman
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*Shining Force font* is licensed under CC-BY-3.0
The FontStruction “Shining Force (Large)” (https://fontstruct.com/fontstructions/show/1624093) by Patrick H. Lauke is licensed under a Creative Commons Attribution license (http://creativecommons.org/licenses/by/3.0/).

BIN
data/images/blank.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

BIN
data/images/cursor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
data/images/fai.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
data/images/inc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
data/images/lep.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
data/images/map.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
data/images/pix.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
data/images/poison.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 B

BIN
data/images/suc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
data/saves/HOLY_ARK_01.bin Normal file

Binary file not shown.

BIN
data/saves/HOLY_ARK_02.bin Normal file

Binary file not shown.

BIN
data/saves/HOLY_ARK_03.bin Normal file

Binary file not shown.

115
data/stha.CT Normal file
View file

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="45">
<CheatEntries>
<CheatEntry>
<ID>0</ID>
<Description>"map id"</Description>
<ShowAsHex>1</ShowAsHex>
<VariableType>2 Bytes</VariableType>
<Address>mednafen_saturn_libretro.dll+792346</Address>
</CheatEntry>
<CheatEntry>
<ID>1</ID>
<Description>"No description"</Description>
<VariableType>2 Bytes</VariableType>
<Address>mednafen_saturn_libretro.dll+A822BE</Address>
</CheatEntry>
<CheatEntry>
<ID>2</ID>
<Description>"Atrhur's HP"</Description>
<VariableType>2 Bytes</VariableType>
<Address>mednafen_saturn_libretro.dll+89AAF0</Address>
</CheatEntry>
<CheatEntry>
<ID>3</ID>
<Description>"X"</Description>
<VariableType>2 Bytes</VariableType>
<Address>mednafen_saturn_libretro.dll+B959E4</Address>
</CheatEntry>
<CheatEntry>
<ID>4</ID>
<Description>"Step Count in the Area"</Description>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>2 Bytes</VariableType>
<Address>mednafen_saturn_libretro.dll+89B852</Address>
</CheatEntry>
<CheatEntry>
<ID>5</ID>
<Description>"Y?"</Description>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>2 Bytes</VariableType>
<Address>mednafen_saturn_libretro.dll+89BBEF</Address>
</CheatEntry>
<CheatEntry>
<ID>6</ID>
<Description>"No description"</Description>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>4 Bytes</VariableType>
<Address>8966025e</Address>
</CheatEntry>
<CheatEntry>
<ID>7</ID>
<Description>"No description"</Description>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>4 Bytes</VariableType>
<Address>89BBEC</Address>
</CheatEntry>
<CheatEntry>
<ID>8</ID>
<Description>"No description"</Description>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>4 Bytes</VariableType>
<Address>36021876</Address>
</CheatEntry>
<CheatEntry>
<ID>9</ID>
<Description>"No description"</Description>
<ShowAsHex>1</ShowAsHex>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>2 Bytes</VariableType>
<Address>mednafen_saturn_libretro.dll+89AB2B</Address>
</CheatEntry>
<CheatEntry>
<ID>10</ID>
<Description>"No description"</Description>
<ShowAsHex>1</ShowAsHex>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>2 Bytes</VariableType>
<Address>mednafen_saturn_libretro.dll+8B708A</Address>
</CheatEntry>
<CheatEntry>
<ID>11</ID>
<Description>"No description"</Description>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>Byte</VariableType>
<Address>mednafen_saturn_libretro.dll+89BD1C</Address>
</CheatEntry>
</CheatEntries>
<CheatCodes>
<CodeEntry>
<Description>move</Description>
<AddressString>mednafen_saturn_libretro.dll+50501</AddressString>
<Before>
<Byte>00</Byte>
<Byte>48</Byte>
<Byte>83</Byte>
<Byte>F0</Byte>
<Byte>01</Byte>
</Before>
<Actual>
<Byte>44</Byte>
<Byte>88</Byte>
<Byte>04</Byte>
<Byte>01</Byte>
</Actual>
<After>
<Byte>8B</Byte>
<Byte>05</Byte>
<Byte>8D</Byte>
<Byte>B5</Byte>
<Byte>92</Byte>
</After>
</CodeEntry>
</CheatCodes>
<UserdefinedSymbols/>
</CheatTable>

128
general.css Normal file
View file

@ -0,0 +1,128 @@
@font-face {
font-family: "ShiningForceFont";
src: url("./shining-force-large.ttf");
}
body {
background-color: transparent;
max-width: 400px;
}
.characters_data {
display: flex;
justify-content: center;
margin-bottom: 5pt;
}
.character_data {
display: none;
border: 3px orange outset;
border-radius: 5pt;
padding: 5pt;
margin-right: 2.5pt;
margin-left: 2.5pt;
background: #14a;
color: white;
font-family: serif;
font-style: italic;
text-shadow: 1px 1px 0px black;
font-variant-numeric: tabular-nums lining-nums;
width: 33%;
}
.character_stat {
display: flex;
justify-content: space-between;
}
.character_data>div:first-of-type {
margin-bottom: 5pt;
}
.character_name_wrapper {
display: flex;
justify-content: space-between;
image-rendering: pixelated;
}
.framed_text {
border: 3px orange outset;
border-radius: 5pt;
padding: 5pt;
background: #14a;
color: white;
font-family: serif;
font-style: italic;
text-shadow: 1px 1px 0px black;
font-variant-numeric: tabular-nums lining-nums;
}
.map_pointer {
color: white;
float: right;
}
.visible {
display: block;
}
.map_wrapper{
width: calc(100% - 10pt);
border: 3px orange outset;
border-radius: 5pt;
margin: 5pt;
background: #14a;
color: white;
font-family: serif;
font-style: italic;
text-shadow: 1px 1px 0px black;
font-variant-numeric: tabular-nums lining-nums;
padding-left : 5pt;
margin-left : 0pt;
}
.map_canvas {
margin-left: -7pt;
}
.pixies_table {
table-layout: fixed;
width: calc(100% - 0pt);
border: 3px orange outset;
border-radius: 5pt;
margin: 5pt;
background: #14a;
color: white;
font-family: serif;
font-style: italic;
text-shadow: 1px 1px 0px black;
font-variant-numeric: tabular-nums lining-nums;
margin-left : 0pt;
}
.pixies_table tr {
display: flex;
justify-content: space-around;
}
.pixies_table td {
padding: 2pt;
display: flex;
align-items: center;
}
.pixies_table SPAN {
padding-left: 2pt;
}
.pixies_table td img {
height: 32px;
}
.item_name {
text-shadow: 0px 0px 2px black, 1px 1px 0px black;
}

536
index.js Normal file
View file

@ -0,0 +1,536 @@
//////
let fs = require("fs")
let memoryjs = require('memoryjs')
let process_name = "RALibretro.exe"
let module_name = 'mednafen_saturn_libretro.dll'
let process = memoryjs.openProcess(process_name)
// get specific dll inside of an EXE
//let modules = memoryjs.getModules(process.th32ProcessID);
// dwSize: 304,
// th32ProcessID: 3996,
// cntThreads: 26,
// th32ParentProcessID: 9416,
// pcPriClassBase: 8,
// szExeFile: 'RALibretro.exe',
// handle: 644,
// modBaseAddr: 140699475116032
let core = memoryjs.findModule(module_name, process.th32ProcessID);
// modBaseAddr: 140714432069632,
// modBaseSize: 24608768,
// szExePath: 'F:\\Games\\Console\\RALibretro\\Cores\\mednafen_saturn_libretro.dll',
// szModule: 'mednafen_saturn_libretro.dll',
// th32ProcessID: 3996,
// GlblcntUsage: 1
let hex2int = function(hex) {
let result = parseInt(Number(hex), 10)
return result
}
let char_tbl = {
[hex2int("0x00")] : ' ',
[hex2int("0x41")] : 'A',
[hex2int("0x42")] : 'B',
[hex2int("0x43")] : 'C',
[hex2int("0x44")] : 'D',
[hex2int("0x45")] : 'E',
[hex2int("0x46")] : 'F',
[hex2int("0x47")] : 'G',
[hex2int("0x48")] : 'H',
[hex2int("0x49")] : 'I',
[hex2int("0x4a")] : 'J',
[hex2int("0x4b")] : 'K',
[hex2int("0x4c")] : 'L',
[hex2int("0x4d")] : 'M',
[hex2int("0x4e")] : 'N',
[hex2int("0x4f")] : 'O',
[hex2int("0x50")] : 'P',
[hex2int("0x51")] : 'Q',
[hex2int("0x52")] : 'R',
[hex2int("0x53")] : 'S',
[hex2int("0x54")] : 'T',
[hex2int("0x55")] : 'U',
[hex2int("0x56")] : 'V',
[hex2int("0x57")] : 'W',
[hex2int("0x58")] : 'X',
[hex2int("0x59")] : 'Y',
[hex2int("0x5a")] : 'Z',
[hex2int("0x61")] : 'a',
[hex2int("0x62")] : 'b',
[hex2int("0x63")] : 'c',
[hex2int("0x64")] : 'd',
[hex2int("0x65")] : 'e',
[hex2int("0x66")] : 'f',
[hex2int("0x67")] : 'g',
[hex2int("0x68")] : 'h',
[hex2int("0x69")] : 'i',
[hex2int("0x6a")] : 'j',
[hex2int("0x6b")] : 'k',
[hex2int("0x6c")] : 'l',
[hex2int("0x6d")] : 'm',
[hex2int("0x6e")] : 'n',
[hex2int("0x6f")] : 'o',
[hex2int("0x70")] : 'p',
[hex2int("0x71")] : 'q',
[hex2int("0x72")] : 'r',
[hex2int("0x73")] : 's',
[hex2int("0x74")] : 't',
[hex2int("0x75")] : 'u',
[hex2int("0x76")] : 'v',
[hex2int("0x77")] : 'w',
[hex2int("0x78")] : 'x',
[hex2int("0x79")] : 'y',
[hex2int("0x7a")] : 'z',
[hex2int("0x21")] : '!',
[hex2int("0x2e")] : '.',
[hex2int("0x2f")] : '/',
[hex2int("0x26")] : '&',
[hex2int("0x2b")] : '+',
[hex2int("0x2c")] : ',',
[hex2int("0x30")] : '0',
[hex2int("0x31")] : '1',
[hex2int("0x32")] : '2',
[hex2int("0x33")] : '3',
[hex2int("0x34")] : '4',
[hex2int("0x35")] : '5',
[hex2int("0x36")] : '6',
[hex2int("0x37")] : '7',
[hex2int("0x38")] : '8',
[hex2int("0x39")] : '9',
[hex2int("0x3a")] : ':',
[hex2int("0x3b")] : ';',
[hex2int("0x3f")] : '?',
[hex2int("0xb0")] : '-',
}
let tint2char = function(int) {
return char_tbl[int]
}
// CE gives module name + offset (hex)
let offsets = {
discrepancy : hex2int("0x77A340"), // 7840576
map_id : hex2int("0x18006"),
event_id : hex2int("0x1cf8ac"),
eid : hex2int("0x1cf8b6"),
ingame_indicator : hex2int("0x121510"),
savefile_name : [
hex2int("0x120731"),
hex2int("0x120730"),
hex2int("0x120733"),
hex2int("0x120732"),
hex2int("0x120735"),
hex2int("0x120734"),
],
hp : {
arthur : hex2int("0x1207b0"),
melody : hex2int("0x12087c"),
rodi : hex2int("0x120948"),
basso : hex2int("0x120a14"),
akane : hex2int("0x120ae0"),
forte : hex2int("0x120bac"),
doyle : hex2int("0x120c78"),
lisa : hex2int("0x120d44"),
enemy1 : hex2int("0x120e10"),
enemy2 : hex2int("0x120edc"),
enemy3 : hex2int("0x120fa8"),
enemy4 : hex2int("0x121074"),
enemy5 : hex2int("0x121140"),
},
max_hp : {
arthur : hex2int("0x12073c"),
melody : hex2int("0x120808"),
rodi : hex2int("0x1208d4"),
basso : hex2int("0x1209a0"),
akane : hex2int("0x120a6c"),
forte : hex2int("0x120b38"),
doyle : hex2int("0x120c04"),
lisa : hex2int("0x120cd0"),
enemy1 : hex2int("0x120d9c"),
enemy2 : hex2int("0x120f34"),
},
mp : {
arthur : hex2int("0x1207b2"),
melody : hex2int("0x12087e"),
rodi : hex2int("0x12094a"),
basso : hex2int("0x120a16"),
akane : hex2int("0x120ae2"),
forte : hex2int("0x120bae"),
lisa : hex2int("0x120d46"),
enemy1 : hex2int("0x120e12"),
enemy2 : hex2int("0x120ede"),
},
max_mp : {
arthur : hex2int("0x12073e"),
melody : hex2int("0x12080a"),
rodi : hex2int("0x1208d6"),
basso : hex2int("0x1209a2"),
akane : hex2int("0x120a6e"),
forte : hex2int("0x120b3a"),
lisa : hex2int("0x120cd2"),
enemy1 : hex2int("0x120d9e"),
enemy2 : hex2int("0x120e2a"),
},
status : {
arthur : hex2int("0x1207eb"),
melody : hex2int("0x1208b7"),
rodi : hex2int("0x120983"),
basso : hex2int("0x120a4f"),
akane : hex2int("0x120b1b"),
forte : hex2int("0x120be7"),
doyle : hex2int("0x120cb3"),
lisa : hex2int("0x120d7f"),
},
position : {
x: hex2int("0x1219dc"),
y: hex2int("0x1219e4"),
z: hex2int("0x1219e1"),
z2: hex2int("0x1219e0"),
north: hex2int("0x1ffc54"),
west: hex2int("0x1ffc58"),
direction: hex2int("0x121a0c")
},
steps : {
area: hex2int("0x121512")
},
characters: {
party:hex2int("0x121501"),
acquired:hex2int("0x121503"),
},
pixies : {
0 : hex2int("0x1215d8"),
1 : hex2int("0x1215da"),
2 : hex2int("0x1215db"),
3 : hex2int("0x1215dc"),
4 : hex2int("0x1215dd"),
5 : hex2int("0x1215de"),
6 : hex2int("0x1215df"),
},
}
function readm(offset, type) {
return memoryjs.readMemory(process.handle, core.modBaseAddr+offsets.discrepancy+offset, type || memoryjs.UINT16)
}
// use this to send data only *1 in a throttle* readings
let throttle = 1
let throttle_counter = 0
let last_map_id
let mapped_data = {}
let maps = {}
let last_pos = {}
let reset_cell_size = true
let reset_cell_size_sent = false
let last_ingame
let last_worldmap
let WSS
if (fs.existsSync('./maps.json')) {
maps = require ('./maps.json')
}
function new_ws_server(port) {
let WS = require('ws')
let lcrypto = require('crypto')
WSS = new WS.Server({port:port})
console.log('listening on ws://'+ 'localhost' +":"+ port)
WSS.send = function (client_id, message) {
let json_data = JSON.stringify(message)
for (let WSC of WSS.clients) {
if (WSC.id == client_id || client_id == "broadcast" || client_id == WSC.client_channel ) {
WSC.send(json_data)
}
}
}
function WSSconnect(ws_client) {
console.log('[WSS] A new client has appeared!')
ws_client.join_time = new Date()
ws_client.on('pong', function() {
// this will re-animate a "dead" client so WSS_dead_clients_check won't kill it
this.alive = true
})
}
WSS.on('connection', WSSconnect)
setInterval(
function() {
let data = {
hp : {},
max_hp : {},
mp : {},
max_mp : {},
status : {},
}
// pixies ---------------------------------------------------------------
let pixies = []
for (let idx in offsets.pixies) {
let batch = (readm(offsets.pixies[idx], memoryjs.UBYTE)).toString(2)
pixies[idx] = ('0'.repeat(8-batch.length) + batch).split("").reverse().join("")
}
data.pixies = pixies.join("").split("")
data.pixies_flags = {
leprechaunt : {
Dana : data.pixies[54],
Tak : data.pixies[55],
Morgan : data.pixies[40],
Kokus : data.pixies[41],
Zircon : data.pixies[42],
Mangus : data.pixies[43],
Darbie : data.pixies[44],
Solo : data.pixies[45],
Stilt : data.pixies[46],
Eric : data.pixies[47],
},
succubus : {
Muran : data.pixies[34],
Dahlia : data.pixies[35],
Roberia : data.pixies[36],
Lacey : data.pixies[37],
Orlea : data.pixies[38],
Ripanos : data.pixies[39],
Kathorea : data.pixies[24],
Viola : data.pixies[25],
Lunaria : data.pixies[26],
Natasha : data.pixies[27],
},
incubus : {
Lantano : data.pixies[28],
Enjewel : data.pixies[29],
Masakari : data.pixies[30],
Krupis : data.pixies[31],
Liknis : data.pixies[48],
Cypress : data.pixies[49],
Aster : data.pixies[50],
Adonis : data.pixies[51],
Croton : data.pixies[52],
Boris : data.pixies[53],
},
pixie : {
Maple : data.pixies[6],
Cherry : data.pixies[7],
Willow : data.pixies[16],
Cedar : data.pixies[17],
Palm : data.pixies[18],
Apple : data.pixies[19],
Lime : data.pixies[20],
Pear : data.pixies[21],
Plum : data.pixies[22],
Baldric : data.pixies[23],
},
fairy : {
Daisy : data.pixies[8],
Iris : data.pixies[9],
Camellia : data.pixies[10],
Peony : data.pixies[11],
Lily : data.pixies[12],
Azalea : data.pixies[13],
Sisal : data.pixies[14],
Mimosa : data.pixies[15],
Primrose : data.pixies[32],
Clyde : data.pixies[33],
},
}
// ------ ---------------------------------------------------------------
data.characters = readm(offsets.characters.acquired).toString(2)
data.party = readm(offsets.characters.party).toString(2)
let acquired_characters = {}
if (data.characters[0]==1) { acquired_characters.arthur = true }
if (data.characters[1]==1) { acquired_characters.melody = true }
if (data.characters[2]==1) { acquired_characters.rodi = true }
if (data.characters[3]==1) { acquired_characters.basso = true }
if (data.characters[4]==1) { acquired_characters.akane = true }
if (data.characters[5]==1) { acquired_characters.forte = true }
if (data.characters[6]==1) { acquired_characters.doyle = true }
if (data.characters[7]==1) { acquired_characters.lisa = true }
let party_characters = {}
if (data.party[0]==1) { party_characters.arthur = true }
if (data.party[1]==1) { party_characters.melody = true }
if (data.party[2]==1) { party_characters.rodi = true }
if (data.party[3]==1) { party_characters.basso = true }
if (data.party[4]==1) { party_characters.akane = true }
if (data.party[5]==1) { party_characters.forte = true }
if (data.party[6]==1) { party_characters.doyle = true }
if (data.party[7]==1) { party_characters.lisa = true }
data.party_characters_list = []
for (let char in party_characters) {
data.party_characters_list.push(char)
}
data.acquired_characters_list = []
for (let char in acquired_characters) {
data.acquired_characters_list.push(char)
}
for (let char of data.party_characters_list) {
data.hp[char] = readm(offsets.hp[char])
data.max_hp[char] = readm(offsets.max_hp[char])
data.mp[char] = readm(offsets.mp[char])
data.max_mp[char] = readm(offsets.max_mp[char])
let char_status = readm(offsets.status[char], memoryjs.BYTE)
let cstat = 'Healthy'
if (char_status != 0) {
if (char_status<=4) {
cstat = 'Poisoned'
} else if (char_status>4) {
cstat = 'Fatally Ill'
}
}
data.status[char] = cstat
}
let direction = readm(offsets.position.direction, memoryjs.UINT16)
let steps_in_area = readm(offsets.steps.area)
let current_location = memoryjs.readMemory(process.handle, core.modBaseAddr+offsets.discrepancy+offsets.eid, memoryjs.UINT16_BE);
let current_location1 = memoryjs.readMemory(process.handle, core.modBaseAddr+offsets.discrepancy+offsets.event_id, memoryjs.UINT16_BE);
let worldmap = readm(offsets.map_id, memoryjs.UINT8)
data.location_id = current_location
data.location_id1 = current_location1
data.steps_in_area = steps_in_area
data.worldmap = worldmap
data.position = {
x: Math.round(readm(offsets.position.x, memoryjs.INT16)/16)/10,
y: Math.round(readm(offsets.position.y, memoryjs.INT16)/16)/10,
z: Math.round(readm(offsets.position.z, memoryjs.INT8)),
z2: Math.round(readm(offsets.position.z2, memoryjs.INT8)),
north: readm(offsets.position.north, memoryjs.UINT8),
west: readm(offsets.position.west, memoryjs.UINT8),
direction : direction/(65536/360),
}
if (current_location && (last_map_id != current_location) || worldmap != last_worldmap) {
data.map_changed = true
maps[last_worldmap] = maps[last_worldmap] || {}
maps[last_worldmap][last_map_id] = mapped_data
mapped_data = maps[worldmap]?.[current_location] || {}
last_map_id = current_location
last_worldmap = worldmap
mapped_data.entrance = {x : data.position.x, y : data.position.y }
mapped_data.map_name = current_location
mapped_data.event_id = current_location1
mapped_data.location = data.worldmap
last_pos.x = data.position.x
last_pos.y = data.position.y
reset_cell_size = true
}
let ingame = (readm(offsets.ingame_indicator, memoryjs.UINT8) == 1)
if ( data.worldmap == 244) {
//data.reset_cell_size = true
} else {
if ( ingame &&
( (last_pos.y != data.position.y) ||
(last_pos.x != data.position.x) ||
( (ingame != last_ingame) &&
last_ingame == 0
)
)
) {
if (reset_cell_size_sent) {
reset_cell_size = false
reset_cell_size_sent = false
}
mapped_data[data.position.x] = mapped_data[data.position.x] || {}
mapped_data[data.position.x][data.position.y] = mapped_data[data.position.x][data.position.y] || {}
//if ( Math.abs(last_pos.y - data.position.y) + Math.abs(last_pos.x - data.position.x) > 1) {
mapped_data[data.position.x][data.position.y] = mapped_data[data.position.x][data.position.y] || {}
mapped_data[data.position.x][data.position.y].additional = mapped_data[data.position.x][data.position.y].additional || {}
// this breaks older paths, need multiple Y coords!
//mapped_data[data.position.x][data.position.y].additional[last_pos.x] = last_pos.y
mapped_data[data.position.x][data.position.y].additional[last_pos.x] = mapped_data[data.position.x][data.position.y].additional[last_pos.x] || {}
mapped_data[data.position.x][data.position.y].additional[last_pos.x][last_pos.y] = true
mapped_data[data.position.x][data.position.y].z = mapped_data[data.position.x][data.position.y].z || {}
if (data.position.z> 0) {mapped_data[data.position.x][data.position.y].z.up = true}
if (data.position.z< 0) {mapped_data[data.position.x][data.position.y].z.down = true}
if (data.position.z==0) {mapped_data[data.position.x][data.position.y].z.middle = true}
mapped_data[data.position.x][data.position.y].z.z1 = data.position.z
mapped_data[data.position.x][data.position.y].z.z2 = data.position.z2
//} else {
//mapped_data[data.position.x][data.position.y] = true
//}
} else {
}
}
last_ingame = ingame
last_pos.x = data.position.x
last_pos.y = data.position.y
data.mapped_data = mapped_data
data.reset_cell_size = reset_cell_size
////////////
let hero_name = []
let hero_name1 = []
let c = 0
for (let i of offsets.savefile_name) {
hero_name1[c] = readm(i, memoryjs.CHAR)
hero_name[c] = tint2char(hero_name1[c])
c = c+1
}
data.hero_name = hero_name
data.hero_name1 = hero_name1
throttle_counter = throttle_counter + 1
if ((throttle_counter > throttle) || data.map_changed) {
throttle_counter = 0
reset_cell_size_sent = true
reset_cell_size = false
WSS.send (
null,
data
)
}
},
100
)
}
new_ws_server(13531)
let save_maps = function () {
fs.writeFile('./maps.json', JSON.stringify(maps || {}) , function() {
setTimeout(
save_maps,
5000
)
})
}
save_maps()
let { spawn, exec } = require('child_process');
let ui = spawn('ui.html', { shell: true, detached : true, stdio: 'ignore' });
ui.unref();
//memoryjs.closeProcess(process.handle);

1
maps.json Normal file

File diff suppressed because one or more lines are too long

17
package.json Normal file
View file

@ -0,0 +1,17 @@
{
"name": "shiningtheholyarkmapper",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"inkpaint": "^2.8.1",
"memoryjs": "^3.5.1",
"pkg": "^5.8.1",
"ws": "^8.18.0"
}
}

BIN
preview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

75
readme.md Normal file
View file

@ -0,0 +1,75 @@
# Shining The Holy Ark Auto Mapper
This is a __*very alpha-state*__ auto mapper for Camelot's "Shining the Holy Ark" game for Sega Saturn.<br>
It should work "out of the box" for RALibRetro emulator with Beetle Saturn (mednafen) core released within past couple years (as of 29th of September, 2024)
The app "attaches" itself to the emulator's process, reads memory while the game still runs, and displays data in a browser window.
![preview](preview.png)
## Why?
The game can map those pesky maps on its own, so... why?
Reasons:
- in-game maps don't show treasures
- in-game maps most of the time don't show obstacles
- to see the the map and stats in-game one has to press a couple of buttons
- it was fun!
## What can it do?
So far it's capable of:
- Displaying the World Map (including your current location)
- Displaying current party members' current and max HP/MP
- Properly reading your character's name
- Mapping dungeons with distinct colors for various floor and ceiling elevation levels
- Mapping cities (something the game doesn't do for you)
- Showing the name of the map you're on (including internal IDs)
- Showing player's current X, Y, and Z coordinates (rounded)
- Showing the direction player's looking in
- Showing treasures' locations and a legend (incomplete)
- Showing exits/stairs (incomplete)
- Counting collected fairies
## How to run
### The `user` way
- Go to [releases](releases) and download the latest `release.zip` file
- Unpack to wherever you'd like
- Delete `maps.json` if you don't need the included map data
- Run the `sthaam.exe`
### The `tech savvy` way
- Download UI from [here](archive/refs/heads/master.zip)
- Unpack UI to wherever you'd like
- Delete `maps.json` if you don't need the included map data
- Go to [releases](releases) and download the latest executable
- Place it in the same folder as ui.html
- Run the `sthaam.exe`
### The `dev` way
(The only way to adjust everything and anything. Might be needed to use with other cores/front ends)
- Get NodeJS from it's [official site](https://nodejs.org/en)
- Clone this repo
- `cd` into the repo
- Install dependencies `npm install`
- Delete `maps.json` if you don't need the included map data
- Run it `node index.js`
## Thanks
- [fbparis](https://mokole.com/palette.html) for distinct colors generator
- [Wolfgang Archive](http://wolfgangarchive.com/stha-web) for inaccurate but very helpful maps
- [Alfex](https://retroachievements.org/user/Alfex) initial StHA cheevo dev
- [Ghal416](https://retroachievements.org/user/Ghal416) StHA set revision dev
- [Cheat Engine](https://cheatengine.org) for memory inspection tools
- [Sega Retro](https://segaretro.org/Shining_the_Holy_Ark) for item images (yet unused)
- [Hitomi](https://github.com/hitomi2500/ss-save-parser) for the Saturn Backup RAM Parser
- [RikaPSO](https://forums.shiningforcecentral.com/memberlist.php?mode=viewprofile&u=31411&sid=ab3f5f3c1e09ef9fd4c9276c5a100a0b) for the save files (included in this repo)

11
ui.html Normal file
View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="general.css" type="text/css">
</head>
<body>
<canvas id="minimap" width="400" height="400"></canvas>
<script src='wsc.js'></script>
</body>
</html>

1864
wsc.js Normal file

File diff suppressed because it is too large Load diff