-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: develop
Are you sure you want to change the base?
Conversation
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]>
Bump minimist from 1.2.5 to 1.2.6
…ons of the same variables, name, and nameHash within the index
…n local files will be used
…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
…ntity reading from the database.
Also adds the skeleton for JS5 game item file decoding
… to speed up index load times and only pull/store blobs on-demand
…ig route to the js5 http server
… JAG indexing bugs
return inter; | ||
} | ||
|
||
async decodeAll(): Promise<void> { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where are you getting this from?
I don't see it in the 435 client, which seems to read 2 bytes regardless
} else if (o === 6) { | ||
item.modelRotationY = data.get('short', 'u'); | ||
} else if (o === 7) { | ||
// client subtracts 65536 if the value is over 32767 |
There was a problem hiding this comment.
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)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they were missing in #194 so I suspect we'll never know
// 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)? |
There was a problem hiding this comment.
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
)
} else if (o === 91) { | ||
item.femaleDialogueModelId1 = data.get('short', 'u'); | ||
} else if (o === 92) { | ||
item.maleDialogueModelId2 = data.get('short', 'u'); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
work in progress