Compare commits

..

No commits in common. "5db84aa14e68dd5ca1fc58f5be0836bfbecaba6c" and "93eb97c83e7be09dcc423be308cbe5d9f9357f46" have entirely different histories.

12 changed files with 174 additions and 240 deletions

121
build.xml
View File

@ -1,65 +1,110 @@
<project name="dothack">
<property file="config.properties"/>
<taskdef resource="antenna.properties" classpath="${antenna.path}"/>
<target name="clean">
<delete dir="build"/>
</target>
<target name="compile">
<mkdir dir="build/classes"/>
<target name="debug">
<mkdir dir="build/classes_debug"/>
<javac
<wtkbuild
includeAntRuntime="false"
srcdir="src"
destdir="build/classes"
destdir="build/classes_debug"
srcdir="src"
source="1.4"
target="1.4"
debug="true"
classpath="${midlet.j2me};${midlet.lib}">
preverify="false"
classpath="${midlet.lib}">
<compilerarg value="-Xlint:-options"/>
</javac>
</wtkbuild>
<jar
destfile="build/${project.name}_not_preverified.jar"
manifest="src/MANIFEST"
compress="true"
level="9">
<wtkjad
jadfile="build/${project.name}_debug.jad"
name="${project.name}"
vendor="${project.vendor}"
version="${project.version}">
<fileset dir="build/classes"/>
<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="assets"/>
<zipfileset src="${midlet.lib}" includes="**/*.class" excludes="example/**/*.class"/>
</jar>
</target>
<!-- using proguard to preverify -->
<argument value="-microedition"/>
<target name="debug">
<antcall target="compile"/>
<!-- proguard args -->
<argument value="-dontshrink -dontoptimize -dontobfuscate -target 1.4"/>
</wtkpackage>
<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">
<antcall target="compile"/>
<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>
<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>

View File

@ -1,11 +1,87 @@
## sdk & tools
proguard.path=/home/sillysagiri/Documents/proguard-7.6.0/lib/proguard.jar
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/
# ======================================================== #
## project
project.name=dothack-allscreen
project.vendor=sillysagiri
project.manifest=MANIFEST.MF
project.version=1.0.0
## Specify library here (separated by `:` )
## midlet
midlet.name=dothack
midlet.class=dothack.DotHack
## Specify library here (separated by `;` )
midlet.lib=library/tinygzip/tinylinegzip.jar
midlet.j2me=library/j2me/cldcapi11.jar:library/j2me/microemu-jsr-75.jar:library/j2me/midpapi20.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
# ======================================================== #

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +0,0 @@
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/

View File

@ -1,43 +1,17 @@
_ _ _ _ _ ____
__| | ___ | |_ | |__ __ _ ___ | | __ (_)|___ \ _ __ ___ ___
/ _` | / _ \ | __|| '_ \ / _` | / __|| |/ /_____ | | __) || '_ ` _ \ / _ \
| (_| || (_) || |_ | | | || (_| || (__ | <|_____|| | / __/ | | | | | || __/
\__,_| \___/ \__||_| |_| \__,_| \___||_|\_\ _/ ||_____||_| |_| |_| \___|
|__/
.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
.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
you can get the game here on archive.net
https://archive.org/details/dh1_ezi
there is also english patch here
there is also people who translate this to english here
https://archive.org/download/dh1_ezi_en
however, due to some native api used in the original game. the game doesnt work
on most emulator.
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
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
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 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
- 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!

View File

@ -1,80 +0,0 @@
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);
}
}

View File

@ -17,6 +17,7 @@ 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;
@ -31,6 +32,7 @@ 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)

View File

@ -1,4 +1,5 @@
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <filesystem>
#include <fstream>

View File

@ -1,72 +0,0 @@
#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;
}

View File

@ -34,12 +34,6 @@ 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();
}