Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@camoto/gamecode

Package Overview
Dependencies
10
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

88

cli/index.js

@@ -137,31 +137,19 @@ /*

this.code = handler.extract(content);
this.origFormat = handler.metadata().id;
this.originalContent = content;
this.handler = handler;
}
async save(params) {
if (!this.handler) {
throw new OperationsError('save: you must "open" a file first.');
}
if (!params.target) {
throw new OperationsError('save: missing filename');
throw new OperationsError('save: missing filename.');
}
if (!params.format) params.format = this.origFormat;
const handler = GameArchive.getHandler(params.format);
if (!handler) {
throw new OperationsError('save: invalid format code: ' + params.format);
}
console.warn('Saving to', params.target);
const outContent = this.handler.patch(this.originalContent, this.code);
const problems = handler.checkLimits(this.archive);
if (problems.length) {
console.log('There are problems preventing the requested changes from taking place:\n');
for (let i = 0; i < problems.length; i++) {
console.log((i + 1).toString().padStart(2) + ': ' + problems[i]);
}
console.log('\nPlease correct these issues and try again.\n');
throw new OperationsError('save: cannot save due to file format limitations.');
}
console.warn('Saving to', params.target, 'as', params.format);
const outContent = handler.generate(this.archive);
let promises = [];
const suppList = handler.supps(params.target, outContent.main);
const suppList = this.handler.supps(params.target, outContent.main);
if (suppList) Object.keys(suppList).forEach(id => {

@@ -177,2 +165,39 @@ console.warn(' - Saving supplemental file', suppList[id]);

}
set(params) {
if (!params.attribute) {
throw new OperationsError('set: missing attribute to change (-a).');
}
if (!params.value) {
throw new OperationsError('set: missing value to set.');
}
for (const [id, a] of Object.entries(this.code.attributes)) {
if (id != params.attribute) {
continue;
}
a.value = params.value;
console.log(`"${id}" set to "${a.value}"`);
return;
}
throw new OperationsError(`set: unable to find attribute "${params.attribute}".`);
}
show(params) {
if (!params.attribute) {
throw new OperationsError('show: must specify an attribute name (use '
+ 'the "list" command to see them all).');
}
const a = this.code.attributes[params.attribute];
if (!a) {
throw new OperationsError(`show: attribute "${params.attribute}" could `
+ 'not be found (use the "list" command to see them all).');
}
process.stdout.write(a.value);
process.stdout.write('\n');
}
}

@@ -193,2 +218,9 @@

],
set: [
{ name: 'attribute', alias: 'a' },
{ name: 'value', defaultOption: true },
],
show: [
{ name: 'attribute', defaultOption: true },
],
};

@@ -256,8 +288,18 @@

save
Save any changed attributes back to the previously opened executable file.
save <filename>
Save any changed attributes to a new file.
set -a <attribute> <value>
Change the value for one of the attributes shown by 'list'.
show <attribute>
Display the raw unprocessed value of the given attribute.
Examples:
# List all available attributes in a file.
gamecode open cosmo1.exe list
# The DEBUG environment variable can be used for troubleshooting.
DEBUG='gamecode:*' gamecode ...
`);

@@ -264,0 +306,0 @@ return;

@@ -39,3 +39,2 @@ /*

/**

@@ -42,0 +41,0 @@ * Get a handler by examining the file content.

{
"name": "@camoto/gamecode",
"version": "1.0.0",
"version": "1.0.1",
"description": "Modify executable files used by DOS games",

@@ -5,0 +5,0 @@ "bin": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc