Compare commits
7 Commits
93eb97c83e
...
5db84aa14e
Author | SHA1 | Date | |
---|---|---|---|
5db84aa14e | |||
0b0d7c876c | |||
16f39adfef | |||
45650789cb | |||
6017055743 | |||
f60fcaa85d | |||
ff5cc78cdc |
121
build.xml
121
build.xml
@ -1,110 +1,65 @@
|
||||
<project name="dothack">
|
||||
|
||||
<property file="config.properties"/>
|
||||
<taskdef resource="antenna.properties" classpath="${antenna.path}"/>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="build"/>
|
||||
</target>
|
||||
|
||||
<target name="debug">
|
||||
<mkdir dir="build/classes_debug"/>
|
||||
<target name="compile">
|
||||
<mkdir dir="build/classes"/>
|
||||
|
||||
<wtkbuild
|
||||
<javac
|
||||
includeAntRuntime="false"
|
||||
destdir="build/classes_debug"
|
||||
srcdir="src"
|
||||
srcdir="src"
|
||||
destdir="build/classes"
|
||||
source="1.4"
|
||||
target="1.4"
|
||||
debug="true"
|
||||
preverify="false"
|
||||
classpath="${midlet.lib}">
|
||||
classpath="${midlet.j2me};${midlet.lib}">
|
||||
|
||||
<compilerarg value="-Xlint:-options"/>
|
||||
</wtkbuild>
|
||||
</javac>
|
||||
|
||||
<wtkjad
|
||||
jadfile="build/${project.name}_debug.jad"
|
||||
name="${project.name}"
|
||||
vendor="${project.vendor}"
|
||||
version="${project.version}">
|
||||
<jar
|
||||
destfile="build/${project.name}_not_preverified.jar"
|
||||
manifest="src/MANIFEST"
|
||||
compress="true"
|
||||
level="9">
|
||||
|
||||
<midlet
|
||||
name="${midlet.name}"
|
||||
class="${midlet.class}">
|
||||
</midlet>
|
||||
|
||||
</wtkjad>
|
||||
|
||||
<wtkpackage
|
||||
jarfile="build/${project.name}_debug.jar"
|
||||
jadfile="build/${project.name}_debug.jad"
|
||||
libclasspath="${midlet.lib}"
|
||||
obfuscate="true"
|
||||
preverify="false">
|
||||
|
||||
<!-- include -->
|
||||
<fileset dir="build/classes_debug"/>
|
||||
<fileset dir="build/classes"/>
|
||||
<fileset dir="assets"/>
|
||||
|
||||
<!-- using proguard to preverify -->
|
||||
<argument value="-microedition"/>
|
||||
<zipfileset src="${midlet.lib}" includes="**/*.class" excludes="example/**/*.class"/>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<!-- proguard args -->
|
||||
<argument value="-dontshrink -dontoptimize -dontobfuscate -target 1.4"/>
|
||||
|
||||
</wtkpackage>
|
||||
<target name="debug">
|
||||
<antcall target="compile"/>
|
||||
|
||||
<java jar="${proguard.path}" fork="true">
|
||||
<arg value="-microedition"/>
|
||||
<arg value="-injars build/${project.name}_not_preverified.jar"/>
|
||||
<arg value="-outjars build/${project.name}_debug.jar"/>
|
||||
<arg value="-libraryjars ${midlet.j2me}"/>
|
||||
<arg value="-dontshrink"/>
|
||||
<arg value="-dontoptimize"/>
|
||||
<arg value="-dontobfuscate"/>
|
||||
<arg value="-target 1.4"/>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="release">
|
||||
<mkdir dir="build/classes_release"/>
|
||||
|
||||
<wtkbuild
|
||||
includeAntRuntime="false"
|
||||
destdir="build/classes_release"
|
||||
srcdir="src"
|
||||
source="1.4"
|
||||
target="1.4"
|
||||
debug="false"
|
||||
preverify="false"
|
||||
classpath="${midlet.lib}">
|
||||
|
||||
<compilerarg value="-Xlint:-options"/>
|
||||
</wtkbuild>
|
||||
|
||||
<wtkjad
|
||||
jadfile="build/${project.name}_release.jad"
|
||||
name="${project.name}"
|
||||
vendor="${project.vendor}"
|
||||
version="${project.version}">
|
||||
|
||||
<midlet
|
||||
name="${midlet.name}"
|
||||
class="${midlet.class}">
|
||||
</midlet>
|
||||
|
||||
</wtkjad>
|
||||
|
||||
<wtkpackage
|
||||
jarfile="build/${project.name}_release.jar"
|
||||
jadfile="build/${project.name}_release.jad"
|
||||
libclasspath="${midlet.lib}"
|
||||
obfuscate="true"
|
||||
preverify="false">
|
||||
|
||||
<!-- include -->
|
||||
<fileset dir="build/classes_release"/>
|
||||
<fileset dir="assets"/>
|
||||
|
||||
<!-- using proguard to preverify -->
|
||||
<argument value="-microedition"/>
|
||||
|
||||
<!-- proguard args -->
|
||||
<argument value="-target 1.4 -keep 'class * extends javax.microedition.midlet.MIDlet' -repackageclasses '' -optimizationpasses 4 -allowaccessmodification"/>
|
||||
|
||||
</wtkpackage>
|
||||
<antcall target="compile"/>
|
||||
|
||||
<java jar="${proguard.path}" fork="true">
|
||||
<arg value="-microedition"/>
|
||||
<arg value="-injars build/${project.name}_not_preverified.jar"/>
|
||||
<arg value="-outjars build/${project.name}_release.jar"/>
|
||||
<arg value="-libraryjars ${midlet.j2me}"/>
|
||||
<arg value="-keep class * extends javax.microedition.midlet.MIDlet"/>
|
||||
<arg value="-repackageclasses"/>
|
||||
<arg value="-target 1.4"/>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
</project>
|
@ -1,87 +1,11 @@
|
||||
## sdk & tools
|
||||
antenna.path=/home/sillysagiri/Documents/antenna/antenna-bin-1.2.1-beta.jar
|
||||
wtk.home=/home/sillysagiri/Documents/wtk/
|
||||
wtk.proguard.home=/home/sillysagiri/Documents/proguard-7.6.0/
|
||||
proguard.path=/home/sillysagiri/Documents/proguard-7.6.0/lib/proguard.jar
|
||||
|
||||
# ======================================================== #
|
||||
|
||||
## project
|
||||
project.name=dothack-allscreen
|
||||
project.vendor=sillysagiri
|
||||
project.manifest=MANIFEST.MF
|
||||
project.version=1.0.0
|
||||
|
||||
## midlet
|
||||
|
||||
midlet.name=dothack
|
||||
midlet.class=dothack.DotHack
|
||||
|
||||
## Specify library here (separated by `;` )
|
||||
## Specify library here (separated by `:` )
|
||||
midlet.lib=library/tinygzip/tinylinegzip.jar
|
||||
|
||||
## Preprocessor
|
||||
symbols=
|
||||
|
||||
|
||||
# ======================================================== #
|
||||
|
||||
## WTK Properties
|
||||
|
||||
## Specifies the version of CLDC to use.
|
||||
wtk.cldc.version=1.1
|
||||
|
||||
## Specifies the version of MIDP to use.
|
||||
wtk.midp.version=2.0
|
||||
|
||||
## Enables or disables the Multimedia API (MMAPI).
|
||||
wtk.mmapi.enabled=true
|
||||
|
||||
## Enables or disables the Wireless Messaging API (WMA) 1.0 (JSR-120).
|
||||
# wtk.wma.enabled true
|
||||
|
||||
## Enables or disables the Wireless Messaging API (WMA) 2.0 (JSR-205).
|
||||
# wtk.wma2.enabled=true
|
||||
|
||||
## Enables or disables the J2ME Web Services API (J2MEWS).
|
||||
# wtk.j2mews.enabled=true
|
||||
|
||||
## Enables or disables the J2ME Bluetooth API (JSR-82).
|
||||
# wtk.bluetooth.enabled=true
|
||||
|
||||
## Enables or disables the J2ME 3D API (JSR-184).
|
||||
# wtk.java3d.enabled=true
|
||||
|
||||
## Enables or disables the J2ME optional PDA packages (JSR-75).
|
||||
# wtk.optionalpda.enabled=true
|
||||
|
||||
## Enables or disables the J2ME location services API (JSR-179).
|
||||
# wtk.locationservices.enabled=true
|
||||
|
||||
## Enables or disables the J2ME content handler API (JSR-211).
|
||||
# wtk.contenthandler.enabled=true
|
||||
|
||||
## Enables or disables the J2ME Security and Trust Services API (JSR-177).
|
||||
# wtk.satsa.enabled=true
|
||||
|
||||
## Enables or disables the J2ME Mobile Internationalization API (JSR-238).
|
||||
# wtk.miapi.enabled=true
|
||||
|
||||
## Enables or disables the J2ME Advanced Multimedia Supplements API (JSR-234).
|
||||
# wtk.ams.enabled=true
|
||||
|
||||
## Enables or disables the J2ME Payment API (JSR-229).
|
||||
# wtk.papi.enabled=true
|
||||
|
||||
## Enables or disables the J2ME Scalable 2D Vector Graphics API (JSR-226).
|
||||
# wtk.s2dvgapi.enabled=true
|
||||
|
||||
## Enables or disables the J2ME Session Initiation Protocol API (JSR-180).
|
||||
# wtk.sipapi.enabled=true
|
||||
|
||||
## Enables all additional libraries (except for CLDC and MIDP) defined for your toolkit.
|
||||
# wtk.all.enabled=true
|
||||
|
||||
## Sets a totally custom BOOTCLASSPATH. Use this property if the set of APIs you need is not covered by the above properties (for example because you are using the system libraries provided another vendor or you have some important additional libraries).
|
||||
# wtk.midpapi=Varies
|
||||
|
||||
# ======================================================== #
|
||||
midlet.j2me=library/j2me/cldcapi11.jar:library/j2me/microemu-jsr-75.jar:library/j2me/midpapi20.jar
|
BIN
library/j2me/cldcapi11.jar
Normal file
BIN
library/j2me/cldcapi11.jar
Normal file
Binary file not shown.
BIN
library/j2me/microemu-jsr-75.jar
Normal file
BIN
library/j2me/microemu-jsr-75.jar
Normal file
Binary file not shown.
BIN
library/j2me/midpapi20.jar
Normal file
BIN
library/j2me/midpapi20.jar
Normal file
Binary file not shown.
6
library/j2me/readme.txt
Normal file
6
library/j2me/readme.txt
Normal file
@ -0,0 +1,6 @@
|
||||
the j2me library was acquired from the microemulator project
|
||||
and used for classpath linking. however, it is not included in the
|
||||
final jar archive and will instead be implemented by the manufacturer
|
||||
|
||||
[microemulator]
|
||||
https://code.google.com/archive/p/microemu/
|
44
readme.txt
44
readme.txt
@ -1,17 +1,43 @@
|
||||
.hack//vol1 is a j2me game originally from old korean game...
|
||||
the original game runs on the mighty cldc 1.0/midp 1.0 and boasts a stunning resolution of 128x128 pixels
|
||||
_ _ _ _ _ ____
|
||||
__| | ___ | |_ | |__ __ _ ___ | | __ (_)|___ \ _ __ ___ ___
|
||||
/ _` | / _ \ | __|| '_ \ / _` | / __|| |/ /_____ | | __) || '_ ` _ \ / _ \
|
||||
| (_| || (_) || |_ | | | || (_| || (__ | <|_____|| | / __/ | | | | | || __/
|
||||
\__,_| \___/ \__||_| |_| \__,_| \___||_|\_\ _/ ||_____||_| |_| |_| \___|
|
||||
|__/
|
||||
|
||||
.hack//vol1 is a j2me game from many of dothack series.
|
||||
the game runs on cldc 1.0/midp 1.0 with resolution of 128x128 pixels
|
||||
|
||||
you can get the game here on archive.net
|
||||
https://archive.org/details/dh1_ezi
|
||||
|
||||
there is also people who translate this to english here
|
||||
there is also english patch here
|
||||
https://archive.org/download/dh1_ezi_en
|
||||
|
||||
however, due to some native apis used in the original game. the game doesnt work on most emulator.
|
||||
ive been on a mission to swap out those stubborn native apis for their midp equivalents
|
||||
however, due to some native api used in the original game. the game doesnt work
|
||||
on most emulator.
|
||||
|
||||
i took on the heroic quest of porting this masterpiece to a more contemporary version of j2me: cldc 1.1/midp 2.0...
|
||||
plus, i also tried added support for larger screens, like 240x320...
|
||||
this is a project in progress to decode the game and rewrite the entire codebase
|
||||
with more contemporary version of j2me cldc 1.1/midp 2.0. swapping out those
|
||||
native api with midp api equivalents. and support the game with bigger screen
|
||||
|
||||
- building
|
||||
ugh... just peek at the build.sh file for now. i promise ill whip up a more detailed guide soon...after i finish this epic battle with caffeine!
|
||||
this project is just for entertainment purposes and for gaining more knowledge
|
||||
about java micro edition.
|
||||
|
||||
*** Building tools ***
|
||||
Requirements:
|
||||
- c/c++ compiler
|
||||
|
||||
most of the tools written in simple single file c++ and can be compiled with
|
||||
your choice of compiler
|
||||
|
||||
*** Building dothack-j2me ***
|
||||
Requirements:
|
||||
- JDK 8, (jdk should be able to target java 1.4)
|
||||
- apache ant
|
||||
|
||||
to build debug mode:
|
||||
ant debug
|
||||
|
||||
to build release mode:
|
||||
ant release
|
80
src/sillysagiri/scene/Credits.java
Normal file
80
src/sillysagiri/scene/Credits.java
Normal file
@ -0,0 +1,80 @@
|
||||
package sillysagiri.scene;
|
||||
|
||||
import javax.microedition.lcdui.Graphics;
|
||||
import javax.microedition.lcdui.Image;
|
||||
|
||||
import sillysagiri.BMF;
|
||||
import sillysagiri.Scene;
|
||||
import sillysagiri.Utils;
|
||||
|
||||
public class Credits extends Scene {
|
||||
|
||||
private BMF bmf_white;
|
||||
private BMF bmf_blue;
|
||||
|
||||
private Image img_loop;
|
||||
private Image img_out;
|
||||
private Image img_c1;
|
||||
|
||||
public void Preload()
|
||||
{
|
||||
try {
|
||||
bmf_white = BMF.Create("/silly/bmf/nds12_0.silly.gz", "/silly/bmf/nds12.fnt", 0xffffffff);
|
||||
bmf_blue = BMF.Create("/silly/bmf/onds12_0.silly.gz", "/silly/bmf/onds12.fnt", 0xff00dbff);
|
||||
|
||||
img_loop = Image.createImage("/m_2.png");
|
||||
img_out = Image.createImage("/out.png");
|
||||
img_c1 = Image.createImage("/c_1.png");
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
sagiri.Set_Scene(new DeathError(e));
|
||||
}
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
}
|
||||
|
||||
public void Update(long dt, Graphics g)
|
||||
{
|
||||
Utils.Clear_Screen(g, 255, 108, 0);
|
||||
|
||||
int loopCount = (int)Math.ceil((float)Utils.GetScreenHeight()/img_loop.getHeight());
|
||||
for (int i = 0; i<loopCount; i++)
|
||||
g.drawImage(img_loop, 0, i*img_loop.getHeight(), Graphics.LEFT | Graphics.TOP);
|
||||
|
||||
int size_header = (int)(bmf_blue.lineHeight*1.5);
|
||||
g.setColor(109, 0, 0);
|
||||
g.fillRect(5, 5, Utils.GetScreenWidth()-10, size_header);
|
||||
|
||||
bmf_blue.DrawEx(g, "Credits", 10, (size_header/2)+5, Graphics.LEFT | Graphics.VCENTER);
|
||||
g.drawImage(img_out, Utils.GetScreenWidth()-10, (size_header/2)+5, Graphics.RIGHT|Graphics.VCENTER);
|
||||
|
||||
int cursory = size_header+20;
|
||||
g.drawImage(img_c1, 10, size_header+20, Graphics.LEFT|Graphics.TOP);
|
||||
|
||||
bmf_white.Draw(g, "Mobile Entertainement", 10, cursory+=img_c1.getHeight()+5);
|
||||
g.setColor(0xffffffff);
|
||||
g.drawLine(10, cursory+= bmf_white.lineHeight+3, Utils.GetScreenWidth()-10, cursory);
|
||||
|
||||
bmf_white.Draw(g, "Programmer:", 10, cursory+=bmf_white.lineHeight/2);
|
||||
bmf_white.DrawEx(g, "Kevn-Ho Kim", Utils.GetScreenWidth()-10, cursory, Graphics.RIGHT|Graphics.TOP);
|
||||
|
||||
bmf_white.Draw(g, "Designer:", 10, cursory+=bmf_white.lineHeight+3);
|
||||
bmf_white.DrawEx(g, "Sung-Hwan Yun", Utils.GetScreenWidth()-10, cursory, Graphics.RIGHT|Graphics.TOP);
|
||||
|
||||
bmf_white.Draw(g, "root93@me-net21.com", 10, cursory+=bmf_white.lineHeight+8);
|
||||
bmf_white.DrawEx(g, "02)2604-4120", Utils.GetScreenWidth()-10, cursory+=bmf_white.lineHeight+3, Graphics.RIGHT|Graphics.TOP);
|
||||
|
||||
g.drawLine(10, cursory+= bmf_white.lineHeight+3, Utils.GetScreenWidth()-10, cursory);
|
||||
|
||||
bmf_white.Draw(g, "English Patch:", 10, cursory+=bmf_white.lineHeight/2);
|
||||
bmf_white.DrawEx(g, "Tyrial", Utils.GetScreenWidth()-10, cursory, Graphics.RIGHT|Graphics.TOP);
|
||||
|
||||
bmf_white.Draw(g, "Remake:", 10, cursory+=bmf_white.lineHeight+3);
|
||||
bmf_white.DrawEx(g, "sillysagiri", Utils.GetScreenWidth()-10, cursory, Graphics.RIGHT|Graphics.TOP);
|
||||
|
||||
bmf_white.Draw(g, "Dothack Network Discord", 10, cursory+=bmf_white.lineHeight+10);
|
||||
}
|
||||
}
|
@ -17,7 +17,6 @@ public class Options extends Scene {
|
||||
|
||||
private Image img_loop;
|
||||
private Image img_out;
|
||||
private Image img_head;
|
||||
private Image img_arrow;
|
||||
|
||||
private int counter = 0;
|
||||
@ -32,7 +31,6 @@ public class Options extends Scene {
|
||||
|
||||
img_loop = Image.createImage("/m_2.png");
|
||||
img_out = Image.createImage("/out.png");
|
||||
img_head = Image.createImage("/s_1.png");
|
||||
img_arrow = Image.createImage("/i_0.png");
|
||||
}
|
||||
catch(Exception e)
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
72
tools/extract/extract.cpp
Normal file
72
tools/extract/extract.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
const uint32_t PNG_SIGNATURE = 0x89504E47;
|
||||
const uint32_t PNG_END_SIGNATURE = 0xAE426082;
|
||||
|
||||
bool readFileToBuffer(const std::string& filename, std::vector<uint8_t>& buffer) {
|
||||
std::ifstream file(filename, std::ios::binary);
|
||||
if (!file) {
|
||||
std::cerr << "Unable to open file: " << filename << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read the entire file into a buffer
|
||||
buffer.assign((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
|
||||
return true;
|
||||
}
|
||||
|
||||
void extractPNGs(const std::string& outdir, const std::vector<uint8_t>& buffer) {
|
||||
size_t offset = 0;
|
||||
size_t fileCount = 0;
|
||||
|
||||
while (offset < buffer.size() - 8) { // Ensure there's enough data for the end signature
|
||||
// Look for the PNG signature
|
||||
if (buffer[offset] == 0x89 && buffer[offset + 1] == 0x50 &&
|
||||
buffer[offset + 2] == 0x4E && buffer[offset + 3] == 0x47) {
|
||||
|
||||
// Check for the end signature starting from the PNG signature position
|
||||
size_t endOffset = offset;
|
||||
while (endOffset <= buffer.size() - 4) {
|
||||
if (buffer[endOffset] == 0xAE && buffer[endOffset + 1] == 0x42 &&
|
||||
buffer[endOffset + 2] == 0x60 && buffer[endOffset + 3] == 0x82) {
|
||||
|
||||
// We found the end signature; extract the PNG
|
||||
std::string outputFilename = std::to_string(fileCount++) + ".png";
|
||||
std::ofstream outFile(outdir + outputFilename, std::ios::binary);
|
||||
if (outFile) {
|
||||
outFile.write(reinterpret_cast<const char*>(&buffer[offset]), endOffset - offset + 4); // Include end signature
|
||||
std::cout << "Extracted: " << outputFilename << std::endl;
|
||||
} else {
|
||||
std::cerr << "Unable to create file: " << outputFilename << std::endl;
|
||||
}
|
||||
|
||||
// Move offset to end of current PNG
|
||||
offset = endOffset + 4; // Move past the end signature
|
||||
break; // Break to search for the next PNG
|
||||
}
|
||||
endOffset++;
|
||||
}
|
||||
}
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc < 3) {
|
||||
std::cerr << "Usage: " << argv[0] << " <input_file> <output_dir>" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
const std::string filename = argv[1]; // Take the input file from command-line argument
|
||||
const std::string outdir = argv[2];
|
||||
std::vector<uint8_t> buffer;
|
||||
|
||||
if (readFileToBuffer(filename, buffer)) {
|
||||
extractPNGs(outdir, buffer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -34,6 +34,12 @@ void writeBinaryFile(const std::string& inputFileName, const std::string& output
|
||||
// outputFile.write(&nullChar, sizeof(nullChar));
|
||||
}
|
||||
|
||||
if (outputFile.fail())
|
||||
{
|
||||
std::cerr << "Error writing to file!" << std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
inputFile.close();
|
||||
outputFile.close();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user