Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Full filestore refactor w/ SQLite3 #35

Draft
wants to merge 33 commits into
base: develop
Choose a base branch
from

Conversation

Katilith
Copy link
Contributor

work in progress

Katilith and others added 30 commits March 14, 2022 14:17
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
…ons of the same variables, name, and nameHash within the index
…ile store support.

Also removed a lot of redundant old code, added in proper todos for stubbed methods, added interface file names to the JS5 archive config, and made everything just a bit cleaner.
…actoring all of the indexing code to support the two differing formats

Also adding in all of the cache file names+hashes for Jag format caches
Also adds the skeleton for JS5 game item file decoding
return inter;
}

async decodeAll(): Promise<void> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as this will be a bit of a pattern across all the different archive types, I wonder if these two decodeAll functions might be better as static factory functions

i.e. rather than

async decodeAll(): Promise<void> {

You could have

static async decodeAll(jagStore: JagFileStore): Promise<JagInterfaceArchive>

inter.unknownServerAttribute2 = data.get('byte', 'unsigned') === 1;
}

if (type === 2) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worth pulling these type values into a set of constants rather than magic numbers

// hoveredPopup = u_short, but only a single u_byte is written if there is no hovered popup
// use u_smart_short ?
inter.hoveredPopup = data.get('byte', 'unsigned');
if (inter.hoveredPopup !== 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} else if (o === 6) {
item.modelRotationY = data.get('short', 'u');
} else if (o === 7) {
// client subtracts 65536 if the value is over 32767

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think so

I suspect that they have custom obfuscation to switch around signed/unsigned method calls in order to do the signing with the result

} else if (o === 26) {
item.femaleModelId2 = data.get('short', 'u');
} else if (o >= 30 && o < 35) {
// cases 27-29 missing - what were they (if anything)?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// so this should be a SIGNED short then, right?...
item.modelOffsetY = data.get('short', 'u');
} else if (o === 10) {
// case 9 missing - what was it (if anything)?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oddly enough 9 is missing in #194 too but was in the code and empty (unlike some of the others here such as 17)

https://github.com/thedaneeffect/RuneScape-Beta-Public/blob/master/src/main/java/rs/data/ObjType.java#L153

} else if (o === 91) {
item.femaleDialogueModelId1 = data.get('short', 'u');
} else if (o === 92) {
item.maleDialogueModelId2 = data.get('short', 'u');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the dialogue model IDs down in 317 as:

  • 90: maleDialogueModelId
  • 91: femaleDialogueModelId
  • 92: maleDialogueHatModelId
  • 93: femaleDialogueHatModelId

This is from a few years back so I'm not 100% sure on them now

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just spent a little while investigating these and they both seem to be used to construct the dialogue model for that item.

Generally 90 and 91 represent the main model while 92 and 93 are additions

Quite often, 90/91 will be a basic human head model and 92/93 will be the head item itself

Sometimes the human head model is bundled into the 90 and 91 models, for example the 'dragon med helm' item:

  • 92: model id 57 (human head with helmet on)
  • 94: model id 71 (horns from d med helm)

whereas other times they are separate for example the 'leather cowl' item:

  • 90: model id 32 (cowl only)
  • 92: model is 63 (human head)

async getFile(fileKey: number): Promise<Js5File | null>;
async getFile(fileName: string): Promise<Js5File | null>;
async getFile(fileIdentifier: number | string): Promise<Js5File | null>;
async getFile(fileIdentifier: number | string): Promise<Js5File | null> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of this code seems very similar to the getArchive code in the Js5FileStore, possibly you can abstract this away

const archiveDetails = archive.index;

if (archiveDetails.key === 255) {
return;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need a louder error? (I'm not sure what key of 255 means)


const INT_MAX = 2147483648;

// Emulate Java's INT overflow-wrapping

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made an iadd function, but it was mostly syntactic sugar

You can just do (a + b) | 0 to emulate the int32 behaviour from Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants