diff --git a/mvnw b/mvnw new file mode 100755 index 0000000..5551fde --- /dev/null +++ b/mvnw @@ -0,0 +1,286 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + wget "$jarUrl" -O "$wrapperJarPath" + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + curl -o "$wrapperJarPath" "$jarUrl" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..e5cfb0a --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,161 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + echo Found %WRAPPER_JAR% +) else ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% +) +@REM End of extension + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..1c464f1 --- /dev/null +++ b/pom.xml @@ -0,0 +1,130 @@ + + + 4.0.0 + + com.grindaga + crissaegrim + Castlevania SOTN Save Editor + Castlevania: Symphony of the Night Save File Editor + 0.0.1-SNAPSHOT + + + 1.8 + 1.3.21 + UTF-8 + com.grindaga.crissaegrim.Loader + + + + + Apache-2.0 + https://opensource.org/licenses/Apache-2.0 + + + + + + mcred + Derek Smart + derek@grindaga.com + + + + + + jcenter + http://jcenter.bintray.com/ + + + + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots + + false + + + true + + + + + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-test-junit + ${kotlin.version} + test + + + org.json + json + 20180130 + + + com.github.spullara.mustache.java + compiler + 0.9.6 + + + commons-codec + commons-codec + 1.12 + + + commons-io + commons-io + 2.6 + + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/test/kotlin + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + ${java.version} + + + + compile + compile + + + test-compile + test-compile + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + test + + java + + + + + ${main.class} + + + + + + diff --git a/src/main/kotlin/com/grindaga/crissaegrim/Card.kt b/src/main/kotlin/com/grindaga/crissaegrim/Card.kt new file mode 100644 index 0000000..7017c2c --- /dev/null +++ b/src/main/kotlin/com/grindaga/crissaegrim/Card.kt @@ -0,0 +1,23 @@ +package com.grindaga.crissaegrim + +import java.io.InputStream +import org.apache.commons.io.IOUtils + +data class Card( + val slots: List +) { + companion object { + @JvmStatic + fun load(saveFile: InputStream): Card { + val byteArray = IOUtils.toByteArray(saveFile) + var slots = mutableListOf() + for (i in 0..15) { + val bottom = i * 0x2000 + val top = bottom + 0x1999 + slots.add(Slot(byteArray.sliceArray(bottom..top))) + } + val card = Card(slots) + return card + } + } +} diff --git a/src/main/kotlin/com/grindaga/crissaegrim/Loader.kt b/src/main/kotlin/com/grindaga/crissaegrim/Loader.kt new file mode 100644 index 0000000..06e4360 --- /dev/null +++ b/src/main/kotlin/com/grindaga/crissaegrim/Loader.kt @@ -0,0 +1,33 @@ +package com.grindaga.crissaegrim + +import com.grindaga.crissaegrim.utils.* +import com.grindaga.crissaegrim.maps.* + +object Loader { + + @JvmStatic + fun main(args: Array) { + val saveFile = this::class.java.classLoader.getResourceAsStream("saves/SampleSave.mcr") + val card: Card = Card.load(saveFile) + val slot: Slot = card.slots[1] + + val stats: Stats = Stats() + + println("HP: ${stats.HP}") + + /* + + for ((key, location) in pointers) { + if (location.reverseBytes) { + val hexVal: ByteArray = slot.getReversedValueByRange(location.getRange()) + val result: Numeric = Numeric(hexVal) + println("${key}: ${result.output()}") + } else { + val hexVal: ByteArray = slot.getValueByRange(location.getRange()) + val result: Numeric = Numeric(hexVal) + println("${key}: ${result.output()}") + } + } + */ + } +} diff --git a/src/main/kotlin/com/grindaga/crissaegrim/Maps/Items.kt b/src/main/kotlin/com/grindaga/crissaegrim/Maps/Items.kt new file mode 100644 index 0000000..30d5e3c --- /dev/null +++ b/src/main/kotlin/com/grindaga/crissaegrim/Maps/Items.kt @@ -0,0 +1,265 @@ +package com.grindaga.crissaegrim.maps + +import com.grindaga.crissaegrim.objects.Location + +data class Items( + val emptyHand: Location = Location(0x25D), + val monsterVial_1: Location = Location(0x25F), + val monsterVial_2: Location = Location(0x260), + val monsterVial_3: Location = Location(0x261), + val shieldRod: Location = Location(0x262), + val leatherShield: Location = Location(0x263), + val knightShield: Location = Location(0x264), + val ironShield: Location = Location(0x265), + val axelordShield: Location = Location(0x266), + val heraldShield: Location = Location(0x267), + val darkShield: Location = Location(0x268), + val goddessShield: Location = Location(0x269), + val shamanShield: Location = Location(0x26A), + val medusaShield: Location = Location(0x26B), + val skullShield: Location = Location(0x26C), + val fireShield: Location = Location(0x26D), + val alucardShield: Location = Location(0x26E), + val swordOfDawn: Location = Location(0x26F), + val basilard: Location = Location(0x270), + val shortSword: Location = Location(0x271), + val combatKnife: Location = Location(0x272), + val nunchuku: Location = Location(0x273), + val wereBane: Location = Location(0x274), + val rapier: Location = Location(0x275), + val karmaCoin: Location = Location(0x276), + val magicMissile: Location = Location(0x277), + val redRust: Location = Location(0x278), + val takemitsu: Location = Location(0x279), + val shotel: Location = Location(0x27A), + val orange: Location = Location(0x27B), + val apple: Location = Location(0x27C), + val banana: Location = Location(0x27D), + val grapes: Location = Location(0x27E), + val strawberry: Location = Location(0x27F), + val pineapple: Location = Location(0x280), + val peanuts: Location = Location(0x281), + val toadstool: Location = Location(0x282), + val shiitake: Location = Location(0x283), + val cheesecake: Location = Location(0x284), + val shortcake: Location = Location(0x285), + val tart: Location = Location(0x286), + val parfait: Location = Location(0x287), + val pudding: Location = Location(0x288), + val iceCream: Location = Location(0x289), + val frankfurter: Location = Location(0x28A), + val hamburger: Location = Location(0x28B), + val pizza: Location = Location(0x28C), + val cheese: Location = Location(0x28D), + val hamAndEggs: Location = Location(0x28E), + val omelette: Location = Location(0x28F), + val morningSet: Location = Location(0x290), + val lunchA: Location = Location(0x291), + val lunchB: Location = Location(0x292), + val curryRice: Location = Location(0x293), + val gyrosPlate: Location = Location(0x294), + val spaghetti: Location = Location(0x295), + val grapeJuice: Location = Location(0x296), + val barleyTea: Location = Location(0x297), + val greenTea: Location = Location(0x298), + val natou: Location = Location(0x299), + val ramen: Location = Location(0x29A), + val misoSoup: Location = Location(0x29B), + val sushi: Location = Location(0x29C), + val porkBun: Location = Location(0x29D), + val readBeanBun: Location = Location(0x29E), + val chineseBun: Location = Location(0x29F), + val dimSumSet: Location = Location(0x2A0), + val potRoast: Location = Location(0x2A1), + val sirloin: Location = Location(0x2A2), + val turkey: Location = Location(0x2A3), + val mealTicket: Location = Location(0x2A4), + val neutronBomb: Location = Location(0x2A5), + val powerOfSire: Location = Location(0x2A6), + val pentagram: Location = Location(0x2A7), + val batPentagram: Location = Location(0x2A8), + val shuriken: Location = Location(0x2A9), + val crossShuriken: Location = Location(0x2AA), + val buffaloShuriken: Location = Location(0x2AB), + val flameShuriken: Location = Location(0x2AC), + val tnt: Location = Location(0x2AD), + val bwakaKnife: Location = Location(0x2AE), + val boomerang: Location = Location(0x2AF), + val javelin: Location = Location(0x2B0), + val tyrfing: Location = Location(0x2B1), + val namakura: Location = Location(0x2B2), + val knuckleDuster: Location = Location(0x2B3), + val gladius: Location = Location(0x2B4), + val scimitar: Location = Location(0x2B5), + val cutlass: Location = Location(0x2B6), + val sabre: Location = Location(0x2B7), + val falchion: Location = Location(0x2B8), + val broadsword: Location = Location(0x2B9), + val bekatowa: Location = Location(0x2BA), + val damascusSword: Location = Location(0x2BB), + val hunterSword: Location = Location(0x2BC), + val estoc: Location = Location(0x2BD), + val bastardSword: Location = Location(0x2BE), + val jewelKnuckles: Location = Location(0x2BF), + val claymore: Location = Location(0x2C0), + val talware: Location = Location(0x2C1), + val katana: Location = Location(0x2C2), + val flameberge: Location = Location(0x2C3), + val ironFist: Location = Location(0x2C4), + val zweiHander: Location = Location(0x2C5), + val swordOfHador: Location = Location(0x2C6), + val luminus: Location = Location(0x2C7), + val harper: Location = Location(0x2C8), + val obsidianSword: Location = Location(0x2C9), + val gram: Location = Location(0x2CA), + val jewelSword: Location = Location(0x2CB), + val mormegil: Location = Location(0x2CC), + val firebrand: Location = Location(0x2CD), + val thunderSword: Location = Location(0x2CE), + val icebrand: Location = Location(0x2CF), + val stoneSword: Location = Location(0x2D0), + val holySword: Location = Location(0x2D1), + val terminusEst: Location = Location(0x2D2), + val marsil: Location = Location(0x2D3), + val darkBlade: Location = Location(0x2D4), + val heavenSword: Location = Location(0x2D5), + val fistOfTulkas: Location = Location(0x2D6), + val gurthang: Location = Location(0x2D7), + val mourneBlade: Location = Location(0x2D8), + val alucardSword: Location = Location(0x2D9), + val mablungSword: Location = Location(0x2DA), + val badelaire: Location = Location(0x2DB), + val swordFamiliar: Location = Location(0x2DC), + val greatSword: Location = Location(0x2DD), + val mace: Location = Location(0x2DE), + val morningstar: Location = Location(0x2DF), + val holyRod: Location = Location(0x2E0), + val starFlail: Location = Location(0x2E1), + val moonRod: Location = Location(0x2E2), + val chakram: Location = Location(0x2E3), + val fireBoomerang: Location = Location(0x2E4), + val ironBall: Location = Location(0x2E5), + val holbeinDagger: Location = Location(0x2E6), + val blueKnuckles: Location = Location(0x2E7), + val dynamite: Location = Location(0x2E8), + val osafuneKatana: Location = Location(0x2E9), + val masamune: Location = Location(0x2EA), + val muramasa: Location = Location(0x2EB), + val heartRefresh: Location = Location(0x2EC), + val runeSword: Location = Location(0x2ED), + val antiVenom: Location = Location(0x2EE), + val uncurse: Location = Location(0x2EF), + val lifeApple: Location = Location(0x2F0), + val hammer: Location = Location(0x2F1), + val strUp: Location = Location(0x2F2), + val lckUp: Location = Location(0x2F3), + val intUp: Location = Location(0x2F4), + val attackUp: Location = Location(0x2F5), + val defenseUp: Location = Location(0x2F6), + val resistFire: Location = Location(0x2F7), + val resistThunder: Location = Location(0x2F8), + val resistIce: Location = Location(0x2F9), + val resistStone: Location = Location(0x2FA), + val resistHoly: Location = Location(0x2FB), + val resistDark: Location = Location(0x2FC), + val potion: Location = Location(0x2FD), + val highPotion: Location = Location(0x2FE), + val elixir: Location = Location(0x2FF), + val mannaPrism: Location = Location(0x300), + val vorpalBlade: Location = Location(0x301), + val crissagrim: Location = Location(0x302), + val yasatsuna: Location = Location(0x303), + val libraryCard: Location = Location(0x304), + val alucartShield: Location = Location(0x305), + val alucartSword: Location = Location(0x306), + val emptyBody: Location = Location(0x307), + val clothTunic: Location = Location(0x308), + val hideCuirass: Location = Location(0x309), + val bronzeCuirass: Location = Location(0x30A), + val ironCuirass: Location = Location(0x30B), + val steelCuirass: Location = Location(0x30C), + val silverPlate: Location = Location(0x30D), + val goldPlate: Location = Location(0x30E), + val platinumMail: Location = Location(0x30F), + val diamondPlate: Location = Location(0x310), + val fireMail: Location = Location(0x311), + val lightningMail: Location = Location(0x312), + val iceMail: Location = Location(0x313), + val mirrorCuirass: Location = Location(0x314), + val spikeBreakerArmor: Location = Location(0x315), + val alucardArmor: Location = Location(0x316), + val darkArmor: Location = Location(0x317), + val healingMail: Location = Location(0x318), + val holyArmor: Location = Location(0x319), + val walkArmor: Location = Location(0x31A), + val brilliantArmor: Location = Location(0x31B), + val mojoMail: Location = Location(0x31C), + val furyPlate: Location = Location(0x31D), + val draculaTunic: Location = Location(0x31E), + val godSGarb: Location = Location(0x31F), + val axelordArmor: Location = Location(0x320), + val emptyHead: Location = Location(0x321), + val sunglasses: Location = Location(0x322), + val ballroomMask: Location = Location(0x323), + val bandanna: Location = Location(0x324), + val feltHat: Location = Location(0x325), + val velvetHat: Location = Location(0x326), + val goggles: Location = Location(0x327), + val leatherHat: Location = Location(0x328), + val holyGlasses: Location = Location(0x329), + val steelHelm: Location = Location(0x32A), + val stoneMask: Location = Location(0x32B), + val circlet: Location = Location(0x32C), + val goldCirclet: Location = Location(0x32D), + val rubyCirclet: Location = Location(0x32E), + val opalCirclet: Location = Location(0x32F), + val topazCirclet: Location = Location(0x330), + val berylCirclet: Location = Location(0x331), + val catEyeCirclet: Location = Location(0x332), + val coralCirclet: Location = Location(0x333), + val dragonHelm: Location = Location(0x334), + val silverCrown: Location = Location(0x335), + val wizardHat: Location = Location(0x336), + val emptyCloak: Location = Location(0x337), + val clothCloak: Location = Location(0x338), + val reverseCloak: Location = Location(0x339), + val elvenCloak: Location = Location(0x33A), + val crystalCloak: Location = Location(0x33B), + val royalCloak: Location = Location(0x33C), + val bloodCloak: Location = Location(0x33D), + val josephsCloak: Location = Location(0x33E), + val twilightCloak: Location = Location(0x33F), + val emptyRelics: Location = Location(0x340), + val moonstone: Location = Location(0x341), + val sunstone: Location = Location(0x342), + val bloodstone: Location = Location(0x343), + val staurolite: Location = Location(0x344), + val ringOfPales: Location = Location(0x345), + val zircon: Location = Location(0x346), + val aquamarine: Location = Location(0x347), + val turquiose: Location = Location(0x348), + val onyx: Location = Location(0x349), + val garnet: Location = Location(0x34A), + val opal: Location = Location(0x34B), + val diamond: Location = Location(0x34C), + val lapisLazuli: Location = Location(0x34D), + val ringOfAres: Location = Location(0x34E), + val goldRing: Location = Location(0x34F), + val silverRing: Location = Location(0x350), + val ringOfVarda: Location = Location(0x351), + val ringOfArcana: Location = Location(0x352), + val mysticPendant: Location = Location(0x353), + val heartBrooch: Location = Location(0x354), + val necklaceOfJ: Location = Location(0x355), + val gauntlet: Location = Location(0x356), + val ankhOfLife: Location = Location(0x357), + val ringOfFeanor: Location = Location(0x358), + val medal: Location = Location(0x359), + val talisman: Location = Location(0x35A), + val duplicator: Location = Location(0x35B), + val kingsStone: Location = Location(0x35C), + val covenantStone: Location = Location(0x35D), + val nauglamir: Location = Location(0x35E), + val secretBoots: Location = Location(0x35F), + val alucartMail: Location = Location(0x360) +) diff --git a/src/main/kotlin/com/grindaga/crissaegrim/Maps/Relics.kt b/src/main/kotlin/com/grindaga/crissaegrim/Maps/Relics.kt new file mode 100644 index 0000000..b165862 --- /dev/null +++ b/src/main/kotlin/com/grindaga/crissaegrim/Maps/Relics.kt @@ -0,0 +1,34 @@ +package com.grindaga.crissaegrim.maps + +import com.grindaga.crissaegrim.objects.Location + +data class Relics( + val soulOfBat: Location = Location(0x238), + val fireOfBat: Location = Location(0x239), + val echoOfBat: Location = Location(0x23A), + val forceOfEcho: Location = Location(0x23B), + val soulOfWolf: Location = Location(0x23C), + val powerOfWolf: Location = Location(0x23D), + val skillOfWolf: Location = Location(0x23E), + val formOfMist: Location = Location(0x23F), + val powerOfMist: Location = Location(0x240), + val gasCloud: Location = Location(0x241), + val cubeOfZoe: Location = Location(0x242), + val spiritOrb: Location = Location(0x243), + val gravityBoots: Location = Location(0x244), + val leapStone: Location = Location(0x245), + val holySymbol: Location = Location(0x246), + val faerieScroll: Location = Location(0x247), + val jewelOfOpen: Location = Location(0x248), + val mermanStatue: Location = Location(0x249), + val batCard: Location = Location(0x24A), + val ghostCard: Location = Location(0x24B), + val faerieCard: Location = Location(0x24C), + val demonCard: Location = Location(0x24D), + val swordCard: Location = Location(0x24E), + val heartOfVlad: Location = Location(0x24F), + val toothOfVlad: Location = Location(0x250), + val ribOfVlad: Location = Location(0x251), + val ringOfVlad: Location = Location(0x252), + val eyeOfVlad: Location = Location(0x253) +) diff --git a/src/main/kotlin/com/grindaga/crissaegrim/Maps/Stats.kt b/src/main/kotlin/com/grindaga/crissaegrim/Maps/Stats.kt new file mode 100644 index 0000000..9707d58 --- /dev/null +++ b/src/main/kotlin/com/grindaga/crissaegrim/Maps/Stats.kt @@ -0,0 +1,17 @@ +package com.grindaga.crissaegrim.maps + +import com.grindaga.crissaegrim.objects.Location + +data class Stats( + val HP: Location = Location(0x474, 1, true), + val HPMax: Location = Location(0x478, 1, true), + val Hearts: Location = Location(0x47C, 1, true), + val HeartsMax: Location = Location(0x480, 1, true), + val MP: Location = Location(0x484, 1, true), + val MPMax: Location = Location(0x488, 1, true), + val STR: Location = Location(0x48C), + val CON: Location = Location(0x490), + val INT: Location = Location(0x494), + val LCK: Location = Location(0x498), + val ATTBonus: Location = Location(0x49) +) diff --git a/src/main/kotlin/com/grindaga/crissaegrim/Objects/Location.kt b/src/main/kotlin/com/grindaga/crissaegrim/Objects/Location.kt new file mode 100644 index 0000000..6d5d45b --- /dev/null +++ b/src/main/kotlin/com/grindaga/crissaegrim/Objects/Location.kt @@ -0,0 +1,11 @@ +package com.grindaga.crissaegrim.objects + +data class Location( + val address: Int, + val length: Int = 0, + val reverseBytes: Boolean = false +) { + fun getRange(): IntRange { + return address..(address + length) + } +} diff --git a/src/main/kotlin/com/grindaga/crissaegrim/Slot.kt b/src/main/kotlin/com/grindaga/crissaegrim/Slot.kt new file mode 100644 index 0000000..16031de --- /dev/null +++ b/src/main/kotlin/com/grindaga/crissaegrim/Slot.kt @@ -0,0 +1,27 @@ +package com.grindaga.crissaegrim + +import com.grindaga.crissaegrim.objects.Location + +data class Slot( + val data: ByteArray +) { + fun getValueAtPosition(position: Int) : Byte { + return data[position] + } + + fun getValueByRange(range: IntRange): ByteArray { + return data.sliceArray(range) + } + + fun getReversedValueByRange(range: IntRange): ByteArray { + return data.sliceArray(range).reversedArray() + } + + fun getValueByLocation(location: Location): ByteArray { + if (location.reverseBytes) { + return getReversedValueByRange(location.getRange()) + } else { + return getValueByRange(location.getRange()) + } + } +} diff --git a/src/main/kotlin/com/grindaga/crissaegrim/Utils/Converter.kt b/src/main/kotlin/com/grindaga/crissaegrim/Utils/Converter.kt new file mode 100644 index 0000000..a21df04 --- /dev/null +++ b/src/main/kotlin/com/grindaga/crissaegrim/Utils/Converter.kt @@ -0,0 +1,6 @@ +package com.grindaga.crissaegrim.utils + +interface Converter{ + val bytes: ByteArray + fun output(): Any +} \ No newline at end of file diff --git a/src/main/kotlin/com/grindaga/crissaegrim/Utils/Numeric.kt b/src/main/kotlin/com/grindaga/crissaegrim/Utils/Numeric.kt new file mode 100644 index 0000000..605f9c5 --- /dev/null +++ b/src/main/kotlin/com/grindaga/crissaegrim/Utils/Numeric.kt @@ -0,0 +1,12 @@ +package com.grindaga.crissaegrim.utils + +import org.apache.commons.codec.binary.Hex + +data class Numeric( + override val bytes: ByteArray +): Converter { + override fun output(): Int { + val hex: String = Hex.encodeHexString(bytes) + return hex.toInt(16) + } +} diff --git a/src/main/kotlin/com/grindaga/crissaegrim/Utils/Text.kt b/src/main/kotlin/com/grindaga/crissaegrim/Utils/Text.kt new file mode 100644 index 0000000..3d08c4b --- /dev/null +++ b/src/main/kotlin/com/grindaga/crissaegrim/Utils/Text.kt @@ -0,0 +1,107 @@ +package com.grindaga.crissaegrim.utils + +data class Text( + val data: ByteArray +): Converter { + override val bytes: ByteArray = data + val charMap: Map = mapOf( + 0x11 to "a", + 0x12 to "b", + 0x13 to "c", + 0x14 to "d", + 0x15 to "e", + 0x16 to "f", + 0x17 to "g", + 0x18 to "h", + 0x19 to "i", + 0x1A to "j", + 0x1B to "k", + 0x1C to "l", + 0x1D to "m", + 0x1E to "n", + 0x1F to "o", + 0x20 to "p", + 0x21 to "q", + 0x22 to "r", + 0x23 to "s", + 0x24 to "t", + 0x25 to "u", + 0x26 to "v", + 0x27 to "w", + 0x28 to "x", + 0x29 to "y", + 0x2A to "z", + 0x2B to "A", + 0x2C to "B", + 0x2D to "C", + 0x2E to "D", + 0x2F to "E", + 0x30 to "F", + 0x31 to "G", + 0x32 to "H", + 0x33 to "I", + 0x34 to "J", + 0x35 to "K", + 0x36 to "L", + 0x37 to "M", + 0x38 to "N", + 0x39 to "O", + 0x3A to "P", + 0x3B to "Q", + 0x3C to "R", + 0x3D to "S", + 0x3E to "T", + 0x39 to "U", + 0x40 to "V", + 0x41 to "W", + 0x42 to "X", + 0x43 to "Y", + 0x44 to "Z", + 0x45 to "0", + 0x46 to "1", + 0x47 to "2", + 0x48 to "3", + 0x49 to "4", + 0x4A to "5", + 0x4B to "6", + 0x4C to "7", + 0x4D to "8", + 0x4E to "9", + 0x4F to ":", + 0x50 to ";", + 0x51 to "\"", + 0x52 to "'", + 0x53 to "'", + 0x54 to "&", + 0x55 to ",", + 0x56 to ".", + 0x57 to "!", + 0x58 to "?", + 0x59 to "(", + 0x5A to ")", + 0x5B to "+", + 0x5C to "-", + 0x5D to "「", + 0x5E to "」", + 0x60 to "·", + 0x61 to "『", + 0x62 to "』", + 0x63 to "◯", + 0x64 to "∆", + 0x65 to "⃞", + 0x66 to "☆" + ) + + override fun output(): String { + var translated: String = "" + for (byte in bytes) { + val text: String = when(charMap[byte.toInt()]) { + null -> " " + else -> charMap[byte.toInt()].toString() + } + translated += text + } + return translated + } + +} diff --git a/icons/icon.png.ico b/src/main/resources/icons/icon.png.ico similarity index 100% rename from icons/icon.png.ico rename to src/main/resources/icons/icon.png.ico diff --git a/src/main/resources/saves/SampleSave.mcr b/src/main/resources/saves/SampleSave.mcr new file mode 100644 index 0000000..83e56f9 Binary files /dev/null and b/src/main/resources/saves/SampleSave.mcr differ