Skip to content

Commit

Permalink
EXPERIMENTAL: RecordStore: Rewrite a big chunk of the RMS subsystem
Browse files Browse the repository at this point in the history
RecordStore operations have to be atomic. This was already covered
by using a Vector for records. What was not being covered were the
multiple instances where checks for an open record store had to
occur. It is checked now, with an implementation that's very similar
to J2ME-Loader. Beside this, some functions like getRecordId and
closeRecordStore weren't implemented... they are now.

Furthermore, the logic to delete and return the number of records
didn't make much sense (at least to me), so that too was rewritten.

There are probably a few more tidbits and changes here and there,
but the ones i've noted are the most important.

NOTE: Even if unlikely, there is still a possibility that this
might break some saves created on the previous implementation,
so beware. (Asphalt2, Sonic Jump, and Orcs & Elves had no issues)
  • Loading branch information
AShiningRay committed Nov 23, 2024
1 parent f9de100 commit f7036b5
Show file tree
Hide file tree
Showing 2 changed files with 149 additions and 84 deletions.
10 changes: 6 additions & 4 deletions src/javax/microedition/rms/RecordEnumeration.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public interface RecordEnumeration

public void destroy();

public int getRecordId(int index) throws IllegalArgumentException, RecordStoreNotOpenException;

public boolean hasNextElement();

public boolean hasPreviousElement();
Expand All @@ -29,15 +31,15 @@ public interface RecordEnumeration

public void keepUpdated(boolean keepUpdated);

public byte[] nextRecord() throws InvalidRecordIDException;
public byte[] nextRecord() throws InvalidRecordIDException, RecordStoreNotOpenException;

public int nextRecordId() throws InvalidRecordIDException;
public int nextRecordId() throws InvalidRecordIDException, RecordStoreNotOpenException;

public int numRecords();

public byte[] previousRecord() throws InvalidRecordIDException;
public byte[] previousRecord() throws InvalidRecordIDException, RecordStoreNotOpenException;

public int previousRecordId() throws InvalidRecordIDException;
public int previousRecordId() throws InvalidRecordIDException, RecordStoreNotOpenException;

public void rebuild();

Expand Down
Loading

0 comments on commit f7036b5

Please sign in to comment.