Check-in [9edcb5e052]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Building of the SquirrelJME ROM.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9edcb5e0524815c453ea83384d3949fe4d14afd5
User & Date: stephanie.gawroriski 2019-07-13 14:21:12
Context
2019-07-13
14:41
Write part of the database fields. check-in: 49d76c6c68 user: stephanie.gawroriski tags: trunk
14:21
Building of the SquirrelJME ROM. check-in: 9edcb5e052 user: stephanie.gawroriski tags: trunk
13:36
Add base for PalmOS distribution; Add base for PalmOS utilities. check-in: cc0e30498e user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added assets/doc/usage-palmos.mkd.



>
1
# PalmOS

Changes to bldt/libs/builder-support/cc/squirreljme/builder/support/dist/PalmOSDist.java.

5
6
7
8
9
10
11



12
13
14
15
16
17
18
19
20
21
22
23




24
25
26
27
28
29
30
31
32









































































33
34
35
36
37
38
39
40
41
42
43
44
45








46
47
48
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.dist;




import java.io.IOException;
import java.io.OutputStream;
import net.multiphasicapps.javac.ZipCompilerOutput;

/**
 * Palm OS distribution.
 *
 * @since 2019/07/13
 */
public class PalmOSDist
	extends SummerCoatROM
{




	/**
	 * Initializes the builder.
	 *
	 * @since 2019/07/13
	 */
	public PalmOSDist()
	{
		super("palmos");
	}









































































	
	/**
	 * {@inheritDoc}
	 * @since 2019/07/13
	 */
	@Override
	protected void generate(ZipCompilerOutput __zip, BuildParameters __bp)
		throws IOException, NullPointerException
	{
		if (__zip == null || __bp == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();








	}
}








>
>
>












>
>
>
>









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>












|
>
>
>
>
>
>
>
>



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.dist;

import dev.shadowtail.palmos.PalmDatabaseBuilder;
import dev.shadowtail.palmos.PalmDatabaseType;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import net.multiphasicapps.javac.ZipCompilerOutput;

/**
 * Palm OS distribution.
 *
 * @since 2019/07/13
 */
public class PalmOSDist
	extends SummerCoatROM
{
	/** The size of a single fragment of the ROM. */
	public static final int ROM_FRAGMENT_SIZE =
		32768;
	
	/**
	 * Initializes the builder.
	 *
	 * @since 2019/07/13
	 */
	public PalmOSDist()
	{
		super("palmos");
	}
	
	/**
	 * Builds the ROM database.
	 *
	 * @param __out The stream to write to.
	 * @param __bp The build parameters.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/07/13
	 */
	protected void buildRomDatabase(OutputStream __out, BuildParameters __bp)
		throws IOException, NullPointerException
	{
		if (__out == null || __bp == null)
			throw new NullPointerException("NARG");
		
		// Build the ROM first and get its bytes
		byte[] romdata = __bp.minimize();
		int romlen = romdata.length;
		
		// The ROM must be split into multiple fragments due to HotSync
		// limitation
		int numfrags = (romlen / ROM_FRAGMENT_SIZE) + 1;
		
		// Create builder for the database
		PalmDatabaseBuilder db = new PalmDatabaseBuilder(
			PalmDatabaseType.RESOURCE);
		
		// Set information on the database
		db.setName("SquirrelJME ROM");
		db.setType("mROM");
		db.setCreator("SjME");
		
		// Write ROM length
		try (DataOutputStream ent = new DataOutputStream(
			db.addEntry("RlEN", 0)))
		{
			ent.writeInt(romlen);
		}
		
		// Write fragment length
		try (DataOutputStream ent = new DataOutputStream(
			db.addEntry("FlEN", 0)))
		{
			ent.writeInt(ROM_FRAGMENT_SIZE);
		}
		
		// Write fragment count
		try (DataOutputStream ent = new DataOutputStream(
			db.addEntry("FnUM", 0)))
		{
			ent.writeInt(numfrags);
		}
		
		// Write every fragment to the database
		for (int i = 0, p = 0; i < numfrags; i++, p += ROM_FRAGMENT_SIZE)
		{
			// Write individual fragment
			try (DataOutputStream ent = new DataOutputStream(
				db.addEntry("FrOM", i)))
			{
				// Write the fragment data
				ent.write(romdata, p, Math.min(romlen - p, ROM_FRAGMENT_SIZE));
				
				// Make sure all fragments are the same size
				if (ent.size() < ROM_FRAGMENT_SIZE)
					ent.write(0);
			}
		}
		
		// Write the output
		db.write(__out);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/07/13
	 */
	@Override
	protected void generate(ZipCompilerOutput __zip, BuildParameters __bp)
		throws IOException, NullPointerException
	{
		if (__zip == null || __bp == null)
			throw new NullPointerException("NARG");
		
		// PalmOS (especially older versions) do not have a concept of a
		// file system so a ROM has to exist as a database
		try (OutputStream out = __zip.output("squirreljme-rom.prc"))
		{
			this.buildRomDatabase(out, __bp);
		}
		
		// Include the PRC that can run the actual ROM!
		todo.TODO.note("Include RatufaCoat squirreljme.prc for now!");
	}
}

Added bldt/libs/palmos-utils/dev/shadowtail/palmos/PalmDatabaseBuilder.java.































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.palmos;

import java.io.IOException;
import java.io.OutputStream;

/**
 * This class is used to build PalmOS databases and resource databases.
 *
 * @since 2019/07/13
 */
public final class PalmDatabaseBuilder
{
	/** The type of database to create. */
	protected final PalmDatabaseType type;
	
	/**
	 * Initializes the database builder.
	 *
	 * @param __type The database type.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/07/13
	 */
	public PalmDatabaseBuilder(PalmDatabaseType __type)
		throws NullPointerException
	{
		if (__type == null)
			throw new NullPointerException("NARG");
		
		this.type = __type;
	}
	
	/**
	 * Adds the specified entry.
	 *
	 * @param __type The entry type.
	 * @param __id The ID to use.
	 * @return The stream to the entry data.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/07/13
	 */
	public final OutputStream addEntry(String __type, int __id)
		throws NullPointerException
	{
		if (__type == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
	
	/**
	 * Sets the creator of the database.
	 *
	 * @param __creat The creator to use.
	 * @return {@code this}.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/07/13
	 */
	public final PalmDatabaseBuilder setCreator(String __creat)
		throws NullPointerException
	{
		if (__creat == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
	
	/**
	 * Sets the name of the database.
	 *
	 * @param __name The name to use.
	 * @return {@code this}.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/07/13
	 */
	public final PalmDatabaseBuilder setName(String __name)
		throws NullPointerException
	{
		if (__name == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
	
	/**
	 * Sets the type of the database.
	 *
	 * @param __type The type to use.
	 * @return {@code this}.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/07/13
	 */
	public final PalmDatabaseBuilder setType(String __type)
		throws NullPointerException
	{
		if (__type == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
	
	/**
	 * Writes the database to the output.
	 *
	 * @param __out The output stream.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/07/13
	 */
	public final void write(OutputStream __out)
		throws IOException, NullPointerException
	{
		if (__out == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

Added bldt/libs/palmos-utils/dev/shadowtail/palmos/PalmDatabaseType.java.

























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.palmos;

/**
 * This represents the database type to use when creating databases.
 *
 * @since 2019/07/13
 */
public enum PalmDatabaseType
{
	/** Resource database. */
	RESOURCE,
	
	/** Record database. */
	RECORD,
	
	/** End. */
	;
}

Added bldt/libs/palmos-utils/dev/shadowtail/palmos/PalmRecord.java.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.palmos;

/**
 * DESCRIBE THIS.
 *
 * @since 2019/07/13
 */
public class PalmRecord
{
}