mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-01-12 12:30:07 +00:00
Merge remote-tracking branch 'upstream/master'
Conflicts: .gitignore
This commit is contained in:
commit
19f86fbc34
14
.gitignore
vendored
14
.gitignore
vendored
@ -1 +1,15 @@
|
|||||||
|
# Ignore vi swap files, MacOS extra files, etc.
|
||||||
|
*.swp
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Skip build directories
|
||||||
|
**/build/
|
||||||
/OutlawEditor/target/
|
/OutlawEditor/target/
|
||||||
|
/Platform/Apple/tools/A2Copy/nbproject/private/
|
||||||
|
/Platform/Apple/tools/A2Copy/dist/
|
||||||
|
|
||||||
|
# Don't check in data specific to any particular game
|
||||||
|
/Platform/Apple/virtual/data/images/*.bin
|
||||||
|
|
||||||
|
# Only check in sample.build.props; each person's build.props will be different.
|
||||||
|
/Platform/Apple/virtual/src/include/build.props
|
||||||
|
19
Platform/Apple/README.md
Normal file
19
Platform/Apple/README.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Building for the Apple II Platform
|
||||||
|
==================================
|
||||||
|
|
||||||
|
1. Build the A2Copy tool, which copies directories in/out of image files: `cd tools/A2Copy`
|
||||||
|
and then `ant`, and finally `cd ../..`
|
||||||
|
|
||||||
|
2. Set the location of the "cc65" tool set. Make a copy of `virtual/src/include/sample.build.props`
|
||||||
|
and call it `build.props` (in that same directory). Edit the `CC65_BIN_DIR` path inside that file
|
||||||
|
to point at your cc65 installation. There should be "ca65", "cc65", "ld65" etc. in the directory
|
||||||
|
you point to.
|
||||||
|
|
||||||
|
3. Add game data. Grab sample game data (images, maps, etc.) and put them into the `data` directory.
|
||||||
|
Image .bin files go in `data/images`, etc.
|
||||||
|
|
||||||
|
4. Now build a complete disk image: `cd virtual` and then `ant`
|
||||||
|
|
||||||
|
5. Boot up the resulting disk image `game.2mg` on your Apple II or emulator.
|
||||||
|
|
||||||
|
6. To run the render demo, type `-RENDER` at the ProDOS Basic prompt.
|
73
Platform/Apple/tools/A2Copy/build.xml
Normal file
73
Platform/Apple/tools/A2Copy/build.xml
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- You may freely edit this file. See commented blocks below for -->
|
||||||
|
<!-- some examples of how to customize the build. -->
|
||||||
|
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||||
|
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||||
|
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||||
|
<!-- the Compile on Save feature is turned off for the project. -->
|
||||||
|
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||||
|
<!-- in the project's Project Properties dialog box.-->
|
||||||
|
<project name="A2Copy" default="default" basedir=".">
|
||||||
|
<description>Builds, tests, and runs the project A2Copy.</description>
|
||||||
|
<import file="nbproject/build-impl.xml"/>
|
||||||
|
<!--
|
||||||
|
|
||||||
|
There exist several targets which are by default empty and which can be
|
||||||
|
used for execution of your tasks. These targets are usually executed
|
||||||
|
before and after some main targets. They are:
|
||||||
|
|
||||||
|
-pre-init: called before initialization of project properties
|
||||||
|
-post-init: called after initialization of project properties
|
||||||
|
-pre-compile: called before javac compilation
|
||||||
|
-post-compile: called after javac compilation
|
||||||
|
-pre-compile-single: called before javac compilation of single file
|
||||||
|
-post-compile-single: called after javac compilation of single file
|
||||||
|
-pre-compile-test: called before javac compilation of JUnit tests
|
||||||
|
-post-compile-test: called after javac compilation of JUnit tests
|
||||||
|
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||||
|
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||||
|
-pre-jar: called before JAR building
|
||||||
|
-post-jar: called after JAR building
|
||||||
|
-post-clean: called after cleaning build products
|
||||||
|
|
||||||
|
(Targets beginning with '-' are not intended to be called on their own.)
|
||||||
|
|
||||||
|
Example of inserting an obfuscator after compilation could look like this:
|
||||||
|
|
||||||
|
<target name="-post-compile">
|
||||||
|
<obfuscate>
|
||||||
|
<fileset dir="${build.classes.dir}"/>
|
||||||
|
</obfuscate>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
For list of available properties check the imported
|
||||||
|
nbproject/build-impl.xml file.
|
||||||
|
|
||||||
|
|
||||||
|
Another way to customize the build is by overriding existing main targets.
|
||||||
|
The targets of interest are:
|
||||||
|
|
||||||
|
-init-macrodef-javac: defines macro for javac compilation
|
||||||
|
-init-macrodef-junit: defines macro for junit execution
|
||||||
|
-init-macrodef-debug: defines macro for class debugging
|
||||||
|
-init-macrodef-java: defines macro for class execution
|
||||||
|
-do-jar: JAR building
|
||||||
|
run: execution of project
|
||||||
|
-javadoc-build: Javadoc generation
|
||||||
|
test-report: JUnit report generation
|
||||||
|
|
||||||
|
An example of overriding the target for project execution could look like this:
|
||||||
|
|
||||||
|
<target name="run" depends="A2Copy-impl.jar">
|
||||||
|
<exec dir="bin" executable="launcher.exe">
|
||||||
|
<arg file="${dist.jar}"/>
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
Notice that the overridden target depends on the jar target and not only on
|
||||||
|
the compile target as the regular run target does. Again, for a list of available
|
||||||
|
properties which you can use, check the target you are overriding in the
|
||||||
|
nbproject/build-impl.xml file.
|
||||||
|
|
||||||
|
-->
|
||||||
|
</project>
|
1
Platform/Apple/tools/A2Copy/lib/VERSIONS
Normal file
1
Platform/Apple/tools/A2Copy/lib/VERSIONS
Normal file
@ -0,0 +1 @@
|
|||||||
|
ac.jar = AppleCommander-1.3.5.13-ac.jar with Martn's patch for proper sub-directory creation
|
BIN
Platform/Apple/tools/A2Copy/lib/ac.jar
Normal file
BIN
Platform/Apple/tools/A2Copy/lib/ac.jar
Normal file
Binary file not shown.
3
Platform/Apple/tools/A2Copy/manifest.mf
Normal file
3
Platform/Apple/tools/A2Copy/manifest.mf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
X-COMMENT: Main-Class will be added automatically by build
|
||||||
|
|
1402
Platform/Apple/tools/A2Copy/nbproject/build-impl.xml
Normal file
1402
Platform/Apple/tools/A2Copy/nbproject/build-impl.xml
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,8 @@
|
|||||||
|
build.xml.data.CRC32=5246bcd2
|
||||||
|
build.xml.script.CRC32=43b3eb1f
|
||||||
|
build.xml.stylesheet.CRC32=8064a381@1.68.1.46
|
||||||
|
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||||
|
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||||
|
nbproject/build-impl.xml.data.CRC32=5246bcd2
|
||||||
|
nbproject/build-impl.xml.script.CRC32=ca8bcaaf
|
||||||
|
nbproject/build-impl.xml.stylesheet.CRC32=cdba79fa@1.68.1.46
|
75
Platform/Apple/tools/A2Copy/nbproject/project.properties
Normal file
75
Platform/Apple/tools/A2Copy/nbproject/project.properties
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
annotation.processing.enabled=true
|
||||||
|
annotation.processing.enabled.in.editor=false
|
||||||
|
annotation.processing.processors.list=
|
||||||
|
annotation.processing.run.all.processors=true
|
||||||
|
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||||
|
application.title=A2Copy
|
||||||
|
application.vendor=mhaye
|
||||||
|
build.classes.dir=${build.dir}/classes
|
||||||
|
build.classes.excludes=**/*.java,**/*.form
|
||||||
|
# This directory is removed when the project is cleaned:
|
||||||
|
build.dir=build
|
||||||
|
build.generated.dir=${build.dir}/generated
|
||||||
|
build.generated.sources.dir=${build.dir}/generated-sources
|
||||||
|
# Only compile against the classpath explicitly listed here:
|
||||||
|
build.sysclasspath=ignore
|
||||||
|
build.test.classes.dir=${build.dir}/test/classes
|
||||||
|
build.test.results.dir=${build.dir}/test/results
|
||||||
|
# Uncomment to specify the preferred debugger connection transport:
|
||||||
|
#debug.transport=dt_socket
|
||||||
|
debug.classpath=\
|
||||||
|
${run.classpath}
|
||||||
|
debug.test.classpath=\
|
||||||
|
${run.test.classpath}
|
||||||
|
# This directory is removed when the project is cleaned:
|
||||||
|
dist.dir=dist
|
||||||
|
dist.jar=${dist.dir}/A2Copy.jar
|
||||||
|
dist.javadoc.dir=${dist.dir}/javadoc
|
||||||
|
endorsed.classpath=
|
||||||
|
excludes=
|
||||||
|
file.reference.ac.jar=lib/ac.jar
|
||||||
|
includes=**
|
||||||
|
jar.compress=false
|
||||||
|
javac.classpath=\
|
||||||
|
${file.reference.ac.jar}
|
||||||
|
# Space-separated list of extra javac options
|
||||||
|
javac.compilerargs=
|
||||||
|
javac.deprecation=false
|
||||||
|
javac.processorpath=\
|
||||||
|
${javac.classpath}
|
||||||
|
javac.source=1.7
|
||||||
|
javac.target=1.7
|
||||||
|
javac.test.classpath=\
|
||||||
|
${javac.classpath}:\
|
||||||
|
${build.classes.dir}
|
||||||
|
javac.test.processorpath=\
|
||||||
|
${javac.test.classpath}
|
||||||
|
javadoc.additionalparam=
|
||||||
|
javadoc.author=false
|
||||||
|
javadoc.encoding=${source.encoding}
|
||||||
|
javadoc.noindex=false
|
||||||
|
javadoc.nonavbar=false
|
||||||
|
javadoc.notree=false
|
||||||
|
javadoc.private=false
|
||||||
|
javadoc.splitindex=true
|
||||||
|
javadoc.use=true
|
||||||
|
javadoc.version=false
|
||||||
|
javadoc.windowtitle=
|
||||||
|
main.class=a2copy.A2Copy
|
||||||
|
manifest.file=manifest.mf
|
||||||
|
meta.inf.dir=${src.dir}/META-INF
|
||||||
|
mkdist.disabled=false
|
||||||
|
platform.active=default_platform
|
||||||
|
run.classpath=\
|
||||||
|
${javac.classpath}:\
|
||||||
|
${build.classes.dir}
|
||||||
|
# Space-separated list of JVM arguments used when running the project.
|
||||||
|
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||||
|
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||||
|
run.jvmargs=
|
||||||
|
run.test.classpath=\
|
||||||
|
${javac.test.classpath}:\
|
||||||
|
${build.test.classes.dir}
|
||||||
|
source.encoding=UTF-8
|
||||||
|
src.dir=src
|
||||||
|
test.src.dir=test
|
15
Platform/Apple/tools/A2Copy/nbproject/project.xml
Normal file
15
Platform/Apple/tools/A2Copy/nbproject/project.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||||
|
<type>org.netbeans.modules.java.j2seproject</type>
|
||||||
|
<configuration>
|
||||||
|
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||||
|
<name>A2Copy</name>
|
||||||
|
<source-roots>
|
||||||
|
<root id="src.dir"/>
|
||||||
|
</source-roots>
|
||||||
|
<test-roots>
|
||||||
|
<root id="test.src.dir"/>
|
||||||
|
</test-roots>
|
||||||
|
</data>
|
||||||
|
</configuration>
|
||||||
|
</project>
|
281
Platform/Apple/tools/A2Copy/src/a2copy/A2Copy.java
Normal file
281
Platform/Apple/tools/A2Copy/src/a2copy/A2Copy.java
Normal file
@ -0,0 +1,281 @@
|
|||||||
|
|
||||||
|
package a2copy;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
||||||
|
import com.webcodepro.applecommander.storage.Disk;
|
||||||
|
import com.webcodepro.applecommander.storage.DiskFullException;
|
||||||
|
import com.webcodepro.applecommander.storage.FileEntry;
|
||||||
|
import com.webcodepro.applecommander.storage.FormattedDisk;
|
||||||
|
import com.webcodepro.applecommander.storage.os.prodos.ProdosFileEntry;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This class uses AppleCommander's command-line interface to extract an entire
|
||||||
|
* set of files and directories from an image, or build a whole image from
|
||||||
|
* files and directories.
|
||||||
|
*
|
||||||
|
* Has specific hard-coded addresses for Lawless Legends files; should fix this
|
||||||
|
* at some point to use a metadata configuration file or something like that.
|
||||||
|
*/
|
||||||
|
public class A2Copy
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Main command-line driver
|
||||||
|
*/
|
||||||
|
public static void main(String[] args)
|
||||||
|
throws IOException, DiskFullException
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (args[0].equals("-get")) {
|
||||||
|
getDirFromImg(args[1], args[2], args[3]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (args[0].equals("-put")) {
|
||||||
|
putDirToImg(args[1], args[2], args[3]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ArrayIndexOutOfBoundsException e)
|
||||||
|
{ }
|
||||||
|
System.err.format("Usage: A2copy [-get imgFile srcImgDir destLocalDir] | [-put imgFile dstImgDir srcLocalDir]\n");
|
||||||
|
System.err.format(" where srcImgDir/dstImgDir is a subdirectory in the image, or / for the root directory.\n");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Patterns used for parsing filenames and paths */
|
||||||
|
static Pattern extPat = Pattern.compile("^(.*)\\.([^.]+)$");
|
||||||
|
static Pattern hashPat = Pattern.compile("^(.*)#([^#]+$)");
|
||||||
|
static Pattern pathPat = Pattern.compile("^/?([^/]+)(.*$)");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract all the files and subdirectories from one directory in an image file, and
|
||||||
|
* write them to the local filesystem.
|
||||||
|
*
|
||||||
|
* @throws IOException if something goes wrong
|
||||||
|
* @throws DiskFullException this actually can't happen (because we're not creating dirs)
|
||||||
|
*/
|
||||||
|
static void getDirFromImg(String imgFile, String srcImgDir, String dstLocalDir) throws IOException, DiskFullException
|
||||||
|
{
|
||||||
|
// Create the local dir if necessary.
|
||||||
|
File localDirFile = new File(dstLocalDir);
|
||||||
|
localDirFile.mkdirs();
|
||||||
|
|
||||||
|
// Open the image file and get the disk inside it.
|
||||||
|
FormattedDisk fd = new Disk(imgFile).getFormattedDisks()[0];
|
||||||
|
|
||||||
|
// Locate the right subdirectory on the disk.
|
||||||
|
DirectoryEntry imgDir = findSubDir(fd, srcImgDir, false);
|
||||||
|
|
||||||
|
// Recursively extract the files from that subdirectory.
|
||||||
|
getAllFiles((List<FileEntry>)imgDir.getFiles(), localDirFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DirectoryEntry findSubDir(DirectoryEntry imgDir, String subDirs, boolean create)
|
||||||
|
throws DiskFullException
|
||||||
|
{
|
||||||
|
Matcher m = pathPat.matcher(subDirs);
|
||||||
|
if (m.matches())
|
||||||
|
{
|
||||||
|
// Process next component of the directory path.
|
||||||
|
String subName = m.group(1);
|
||||||
|
String remaining = m.group(2);
|
||||||
|
for (FileEntry e : (List<FileEntry>)imgDir.getFiles()) {
|
||||||
|
if (!e.isDeleted() && e.isDirectory() && e.getFilename().equalsIgnoreCase(subName))
|
||||||
|
return findSubDir((DirectoryEntry)e, remaining, create);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not found. If we're not allowed to create it, error out.
|
||||||
|
if (!create) {
|
||||||
|
System.err.format("Error: subdirectory '%s' not found.\n", subDirs);
|
||||||
|
System.exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the subdirectory and continue to sub-sub-dirs.
|
||||||
|
return findSubDir(imgDir.createDirectory(subName.toUpperCase()), remaining, create);
|
||||||
|
}
|
||||||
|
|
||||||
|
return imgDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper for file/directory extraction.
|
||||||
|
* @param files set of files to extract
|
||||||
|
* @param dstTargetDir where to put them
|
||||||
|
* @throws IOException if something goes wrong
|
||||||
|
*/
|
||||||
|
static void getAllFiles(List<FileEntry> files, File dstTargetDir) throws IOException
|
||||||
|
{
|
||||||
|
// Ensure the target directory exists
|
||||||
|
dstTargetDir.mkdir();
|
||||||
|
|
||||||
|
// Make a map of the existing filesystem files so we can match them. This way,
|
||||||
|
// we can retain whatever case regime the user has established on the filesystem.
|
||||||
|
//
|
||||||
|
HashMap<String, File> existingFiles = new HashMap<>();
|
||||||
|
HashMap<String, String> baseMap = new HashMap<>();
|
||||||
|
for (File f: dstTargetDir.listFiles())
|
||||||
|
{
|
||||||
|
if (!f.isFile())
|
||||||
|
continue;
|
||||||
|
String name = f.getName();
|
||||||
|
existingFiles.put(name.toLowerCase(), f);
|
||||||
|
|
||||||
|
Matcher m = hashPat.matcher(name);
|
||||||
|
if (m.matches())
|
||||||
|
name = m.group(1);
|
||||||
|
existingFiles.put(name.toLowerCase(), f);
|
||||||
|
|
||||||
|
m = extPat.matcher(name);
|
||||||
|
if (m.matches())
|
||||||
|
name = m.group(1);
|
||||||
|
existingFiles.put(name.toLowerCase(), f);
|
||||||
|
|
||||||
|
baseMap.put(f.getName(), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process each entry in the list
|
||||||
|
for (FileEntry e : files)
|
||||||
|
{
|
||||||
|
// Skip deleted things
|
||||||
|
if (e.isDeleted())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Determine the filename we should use locally. If there's a matching
|
||||||
|
// file already here, use its base.
|
||||||
|
//
|
||||||
|
String baseName = e.getFilename().toLowerCase();
|
||||||
|
if (existingFiles.containsKey(baseName)) {
|
||||||
|
File existingFile = existingFiles.get(baseName);
|
||||||
|
baseName = baseMap.get(existingFile.getName());
|
||||||
|
existingFile.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recursively process sub-directories
|
||||||
|
if (e.isDirectory()) {
|
||||||
|
File subDir = new File(dstTargetDir, baseName);
|
||||||
|
getAllFiles(((DirectoryEntry)e).getFiles(), subDir);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a hash for the file type.
|
||||||
|
String outName = baseName + "." + e.getFiletype().toLowerCase();
|
||||||
|
|
||||||
|
// Add a hash for the address if this kind of entry uses one.
|
||||||
|
if (e.needsAddress()) {
|
||||||
|
int auxType = ((ProdosFileEntry)e).getAuxiliaryType();
|
||||||
|
outName = outName + "#" + Integer.toHexString(auxType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ready to copy the data.
|
||||||
|
byte[] data = e.getFileData();
|
||||||
|
try (FileOutputStream out = new FileOutputStream(new File(dstTargetDir, outName))) {
|
||||||
|
out.write(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put a whole directory of files/subdirs from the local filesystem into a
|
||||||
|
* subdirectory of an image file.
|
||||||
|
*
|
||||||
|
* @param imgFilePath path to the image file
|
||||||
|
* @param dstImgDir subdirectory in the image file, or "/" for the root
|
||||||
|
* @param srcLocalDir directory containing files and subdirs
|
||||||
|
* @throws DiskFullException if the image file fills up
|
||||||
|
* @throws IOException if something else goes wrong
|
||||||
|
*/
|
||||||
|
static void putDirToImg(String imgFilePath, String dstImgDir, String srcLocalDir)
|
||||||
|
throws IOException, DiskFullException
|
||||||
|
{
|
||||||
|
// Make sure the local dir exists.
|
||||||
|
File localDirFile = new File(srcLocalDir);
|
||||||
|
if (!localDirFile.isDirectory()) {
|
||||||
|
System.err.format("Error: Local directory '%s' not found.\n", srcLocalDir);
|
||||||
|
System.exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open the image file.
|
||||||
|
FormattedDisk fd = new Disk(imgFilePath).getFormattedDisks()[0];
|
||||||
|
|
||||||
|
// Get to the right sub-directory.
|
||||||
|
DirectoryEntry ent = findSubDir(fd, dstImgDir, true);
|
||||||
|
|
||||||
|
// And fill it up.
|
||||||
|
putAllFiles(fd, ent, localDirFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper for image creation.
|
||||||
|
*
|
||||||
|
* @param fd disk to insert files into
|
||||||
|
* @param targetDir directory within the disk
|
||||||
|
* @param srcDir filesystem directory to read
|
||||||
|
* @throws DiskFullException if the image file fills up
|
||||||
|
* @throws IOException if something else goes wrong
|
||||||
|
*/
|
||||||
|
private static void putAllFiles(FormattedDisk fd, DirectoryEntry targetDir, File srcDir)
|
||||||
|
throws DiskFullException, IOException
|
||||||
|
{
|
||||||
|
// Process each file in the source directory
|
||||||
|
for (File srcFile : srcDir.listFiles())
|
||||||
|
{
|
||||||
|
if (srcFile.isDirectory()) {
|
||||||
|
DirectoryEntry subDir = targetDir.createDirectory(srcFile.getName().toUpperCase());
|
||||||
|
putAllFiles(fd, subDir, srcFile);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse and strip the hash (address) and extension if any
|
||||||
|
String name = srcFile.getName();
|
||||||
|
String hash = "0";
|
||||||
|
Matcher m = hashPat.matcher(name);
|
||||||
|
if (m.matches()) {
|
||||||
|
name = m.group(1);
|
||||||
|
hash = m.group(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ext = "0";
|
||||||
|
m = extPat.matcher(name);
|
||||||
|
if (m.matches()) {
|
||||||
|
name = m.group(1);
|
||||||
|
ext = m.group(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new entry in the disk image for this file.
|
||||||
|
FileEntry ent = targetDir.createFile();
|
||||||
|
ent.setFilename(name.toUpperCase());
|
||||||
|
|
||||||
|
// Set the file type using the extension we parsed above.
|
||||||
|
ent.setFiletype(ext);
|
||||||
|
|
||||||
|
// Set the address if we have one and this kind of file wants one.
|
||||||
|
if (ent.needsAddress())
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
ent.setAddress(Integer.parseInt(hash, 16));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e) { /*pass*/ }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy the file data
|
||||||
|
FileInputStream in = new FileInputStream(srcFile);
|
||||||
|
byte[] buf = new byte[(int) srcFile.length()];
|
||||||
|
int nRead = in.read(buf);
|
||||||
|
if (nRead != srcFile.length())
|
||||||
|
throw new IOException(String.format("Error reading file '%s'", srcFile.toString()));
|
||||||
|
ent.setFileData(buf);
|
||||||
|
|
||||||
|
// And save the new entry.
|
||||||
|
fd.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
57
Platform/Apple/virtual/build.xml
Normal file
57
Platform/Apple/virtual/build.xml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<project name="game" default="build">
|
||||||
|
|
||||||
|
<property name="projName" value="game"/> <!-- base part of output file name -->
|
||||||
|
<property name="src.dir" location="./src"/>
|
||||||
|
<property name="build.dir" value="./build"/>
|
||||||
|
<property name="a2copy.dir" value="../tools/A2Copy/dist"/>
|
||||||
|
|
||||||
|
<property name="IMG_FILE" value="${build.dir}/${projName}.bin#${ORG_ADDR}"/>
|
||||||
|
|
||||||
|
<target name="all">
|
||||||
|
<antcall target="clean"/>
|
||||||
|
<antcall target="build"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="clean">
|
||||||
|
<delete failonerror="false" dir="${build.dir}"/>
|
||||||
|
<ant dir="${src.dir}/raycast" target="clean" useNativeBasedir="true" inheritAll="false"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="build">
|
||||||
|
|
||||||
|
<!-- Create build directory -->
|
||||||
|
<mkdir dir="${build.dir}"/>
|
||||||
|
|
||||||
|
<!-- Build sub-projects -->
|
||||||
|
<echo>Building raycast.</echo>
|
||||||
|
<ant dir="${src.dir}/raycast" target="build" useNativeBasedir="true" inheritAll="false"/>
|
||||||
|
|
||||||
|
<!-- Construct a directory to put on the Apple -->
|
||||||
|
<mkdir dir="${build.dir}/root"/>
|
||||||
|
<copy todir="${build.dir}/root">
|
||||||
|
<fileset dir="${src.dir}/raycast/build" includes="*.bin*"/>
|
||||||
|
</copy>
|
||||||
|
<mkdir dir="${build.dir}/root/"/>
|
||||||
|
<copy todir="${build.dir}/root/assets">
|
||||||
|
<fileset dir="./data/images" includes="*.bin*"/>
|
||||||
|
</copy>
|
||||||
|
<copy todir="${build.dir}/root/assets">
|
||||||
|
<fileset dir="./data/tables" includes="*.bin*"/>
|
||||||
|
</copy>
|
||||||
|
|
||||||
|
<!-- Make a new base image file -->
|
||||||
|
<bunzip2 src="./data/disks/base.2mg.bz2" dest="${build.dir}/${projName}.2mg"/>
|
||||||
|
|
||||||
|
<!-- And stuff the directory into it -->
|
||||||
|
<java jar="${a2copy.dir}/a2copy.jar" fork="true" failonerror="true">
|
||||||
|
<arg value="-put"/>
|
||||||
|
<arg value="${build.dir}/${projName}.2mg"/>
|
||||||
|
<arg value="/"/>
|
||||||
|
<arg value="${build.dir}/root"/>
|
||||||
|
</java>
|
||||||
|
|
||||||
|
</target>
|
||||||
|
|
||||||
|
</project>
|
BIN
Platform/Apple/virtual/data/disks/base.2mg.bz2
Normal file
BIN
Platform/Apple/virtual/data/disks/base.2mg.bz2
Normal file
Binary file not shown.
BIN
Platform/Apple/virtual/data/tables/precast.bin
Normal file
BIN
Platform/Apple/virtual/data/tables/precast.bin
Normal file
Binary file not shown.
8
Platform/Apple/virtual/src/include/sample.build.props
Normal file
8
Platform/Apple/virtual/src/include/sample.build.props
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Put your local development paths here
|
||||||
|
# Take note of the path delimiters (ie: the / )
|
||||||
|
|
||||||
|
# Required entries
|
||||||
|
# CC65_BIN_DIR
|
||||||
|
|
||||||
|
# Examples
|
||||||
|
CC65_BIN_DIR=/opt/local/bin
|
56
Platform/Apple/virtual/src/raycast/build.xml
Normal file
56
Platform/Apple/virtual/src/raycast/build.xml
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<project name="render" default="build">
|
||||||
|
|
||||||
|
<property name="projName" value="render"/> <!-- base part of output bin name -->
|
||||||
|
<property name="src.dir" location="."/>
|
||||||
|
<property name="include.dir" location="../include"/>
|
||||||
|
<property file="${include.dir}/build.props"/> <!-- needs to define CC65_BIN_DIR -->
|
||||||
|
|
||||||
|
<property name="build.dir" value="${src.dir}/build"/>
|
||||||
|
|
||||||
|
<property name="CA65_TOOL" location="${CC65_BIN_DIR}/ca65"/>
|
||||||
|
<property name="LD65_TOOL" location="${CC65_BIN_DIR}/ld65"/>
|
||||||
|
|
||||||
|
<property name="ASM_SETTINGS" value="-t apple2"/>
|
||||||
|
<property name="ASM_INCLUDES" value="-I .."/>
|
||||||
|
|
||||||
|
<property name="ORG_ADDR" value="900"/> <!-- load address, in hex -->
|
||||||
|
|
||||||
|
<property name="BIN_FILE" value="${build.dir}/${projName}.bin#${ORG_ADDR}"/>
|
||||||
|
|
||||||
|
<target name="all">
|
||||||
|
<antcall target="clean"/>
|
||||||
|
<antcall target="build"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="clean">
|
||||||
|
<delete failonerror="false" dir="${build.dir}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="build">
|
||||||
|
|
||||||
|
<!-- Create build directory -->
|
||||||
|
<mkdir dir="${build.dir}"/>
|
||||||
|
|
||||||
|
<!-- Compile ASM -->
|
||||||
|
<apply executable="${CA65_TOOL}" dir="${src.dir}" relative="true" parallel="false" verbose="true">
|
||||||
|
<fileset dir="${src.dir}" includes="*.s"/>
|
||||||
|
<mapper type="glob" from="*.s" to="${build.dir}/*.o"/>
|
||||||
|
<arg line="${ASM_INCLUDES}"/>
|
||||||
|
<arg line="${ASM_SETTINGS}"/>
|
||||||
|
<arg line="-o"/>
|
||||||
|
<targetfile/>
|
||||||
|
<srcfile/>
|
||||||
|
</apply>
|
||||||
|
|
||||||
|
<!-- Link it -->
|
||||||
|
<apply executable="${LD65_TOOL}" dir="${build.dir}" failonerror="true" verbose="true">
|
||||||
|
<arg line="-t none --start-addr 0x${ORG_ADDR} -o"/>
|
||||||
|
<arg value="${BIN_FILE}"/>
|
||||||
|
<fileset dir="${build.dir}" includes="*.o"/>
|
||||||
|
</apply>
|
||||||
|
|
||||||
|
</target>
|
||||||
|
|
||||||
|
</project>
|
1149
Platform/Apple/virtual/src/raycast/render.s
Normal file
1149
Platform/Apple/virtual/src/raycast/render.s
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user