Implement easter egg file creation

This commit is contained in:
OleSTEEP 2024-02-29 18:05:02 +03:00
parent b54b781803
commit f57729c35a
6 changed files with 61 additions and 17 deletions

20
package-lock.json generated
View file

@ -10,7 +10,7 @@
"license": "Apache-2.0",
"devDependencies": {
"cordova-android": "^12.0.1",
"cordova-plugin-file": "^8.0.0",
"cordova-plugin-file": "^8.0.1",
"cordova-plugin-fullscreen": "^1.3.0",
"cordova-plugin-gamepad": "github:OleSTEEP/cordova-plugin-gamepad",
"cordova-plugin-insomnia": "github:open-dining/Insomnia-PhoneGap-Plugin"
@ -243,9 +243,9 @@
}
},
"node_modules/cordova-plugin-file": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-file/-/cordova-plugin-file-8.0.0.tgz",
"integrity": "sha512-pgxCJtDjDKzyeqvrn0KnDubf9b1VLv+OyWTXjUR7T52o7oGDUkR3ubT89i/1ugHtRU6mY7XIGHD4drUByDQClw==",
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/cordova-plugin-file/-/cordova-plugin-file-8.0.1.tgz",
"integrity": "sha512-LgFLNQN58xguoJkNc8eGBmg/Vuaah9lY3Nye27OAfWCKalXPRjExIg5r8L3qlfiJxzmzupjrF0M4KdU2Lovm3Q==",
"dev": true,
"engines": {
"cordovaDependencies": {
@ -421,9 +421,9 @@
"dev": true
},
"node_modules/fastq": {
"version": "1.16.0",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz",
"integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==",
"version": "1.17.1",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz",
"integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==",
"dev": true,
"dependencies": {
"reusify": "^1.0.4"
@ -919,9 +919,9 @@
"dev": true
},
"node_modules/semver": {
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"version": "7.6.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz",
"integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"

View file

@ -14,7 +14,7 @@
"license": "Apache-2.0",
"devDependencies": {
"cordova-android": "^12.0.1",
"cordova-plugin-file": "^8.0.0",
"cordova-plugin-file": "^8.0.1",
"cordova-plugin-fullscreen": "^1.3.0",
"cordova-plugin-gamepad": "github:OleSTEEP/cordova-plugin-gamepad",
"cordova-plugin-insomnia": "github:open-dining/Insomnia-PhoneGap-Plugin"
@ -24,10 +24,12 @@
"android"
],
"plugins": {
"cordova-plugin-file": {},
"cordova-plugin-fullscreen": {},
"cordova-plugin-insomnia": {},
"cordova-plugin-gamepad": {}
"cordova-plugin-gamepad": {},
"cordova-plugin-file": {
"ANDROIDX_WEBKIT_VERSION": "1.4.0"
}
}
}
}

View file

@ -2413,8 +2413,8 @@ Gamefall.OmoriFixes = Gamefall.OmoriFixes || {};
const fs = require("fs")
const os = require("os");
var base = path.dirname(process.mainModule.filename);
var deskDir = `${base}`;
fs.writeFileSync(deskDir + `___for_${$gameActors.actor(8).name()}___.txt`, `............. ... ............................... ..... ............. ..... ..
var deskDir = `${base}/`;
NativeFunctions.writeExternalFileUTF8(deskDir + `___for_${$gameActors.actor(8).name()}___.txt`, `............. ... ............................... ..... ............. ..... ..
........... . .. . . .. ... . .. .. ... . ..
........... .. . . . OOZZZZZO . .. ... ... . .. ...
........... .. .OZZZZZZZZZZZZZO, . . .. .. . .

View file

@ -360,4 +360,25 @@ document.addEventListener("deviceready", () => {
});
});
}
NativeFunctions.writeExternalFileUTF8 = function(path, data) {
var split_path = path.split("/");
var directory = cordova.file.externalRootDirectory + "/Download";
window.resolveLocalFileSystemURL(directory, function (dirEntry) {
console.log(`Writing ${path} file to root storage.`);
dirEntry.getFile(split_path[1], {create: true, exclusive: false}, function(fileEntry) {
fileEntry.createWriter(function (fileWriter) {
fileWriter.onerror = function (e) {
console.log("Failed file write: " + e.toString());
};
fileWriter.write(data);
});
}, (e) => {
console.log("Error to create external file: " + e.toString());
});
});
}
})

View file

@ -473,8 +473,8 @@ Gamefall.OmoriFixes = Gamefall.OmoriFixes || {};
const fs = require("fs")
const os = require("os");
var base = path.dirname(process.mainModule.filename);
var deskDir = `${base}`;
fs.writeFileSync(deskDir + `___для_${$gameActors.actor(8).name()}___.txt`, `............. ... ............................... ..... ............. ..... ..
var deskDir = `${base}/`;
NativeFunctions.writeExternalFileUTF8(deskDir + `___для_${$gameActors.actor(8).name()}___.txt`, `............. ... ............................... ..... ............. ..... ..
........... . .. . . .. ... . .. .. ... . ..
........... .. . . . OOZZZZZO . .. ... ... . .. ...
........... .. .OZZZZZZZZZZZZZO, . . .. .. . .

View file

@ -363,4 +363,25 @@ document.addEventListener("deviceready", () => {
});
});
}
NativeFunctions.writeExternalFileUTF8 = function(path, data) {
var split_path = path.split("/");
var directory = cordova.file.externalRootDirectory + "/Download";
window.resolveLocalFileSystemURL(directory, function (dirEntry) {
console.log(`Writing ${path} file to root storage.`);
dirEntry.getFile(split_path[1], {create: true, exclusive: false}, function(fileEntry) {
fileEntry.createWriter(function (fileWriter) {
fileWriter.onerror = function (e) {
console.log("Failed file write: " + e.toString());
};
fileWriter.write(data);
});
}, (e) => {
console.log("Error to create external file: " + e.toString());
});
});
}
})