"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PlayStationMobileExporter = void 0; const fs = require("fs-extra"); const path = require("path"); const CSharpExporter_1 = require("./CSharpExporter"); const ImageTool_1 = require("../ImageTool"); const uuid = require('uuid'); class PlayStationMobileExporter extends CSharpExporter_1.CSharpExporter { constructor(options) { super(options); this.files = []; } backend() { return 'PSM'; } exportSLN(projectUuid) { fs.ensureDirSync(path.join(this.options.to, this.sysdir() + '-build')); this.writeFile(path.join(this.options.to, this.sysdir() + '-build', 'Project.sln')); const solutionUuid = uuid.v4(); this.p('Microsoft Visual Studio Solution File, Format Version 11.00'); this.p('# Visual Studio 2010'); this.p('Project("{' + solutionUuid.toString().toUpperCase() + '}") = "HaxeProject", "Project.csproj", "{' + projectUuid.toString().toUpperCase() + '}"'); this.p('EndProject'); this.p('Global'); this.p('GlobalSection(SolutionConfigurationPlatforms) = preSolution', 1); this.p('Debug|Any CPU = Debug|Any CPU', 2); this.p('Release|Any CPU = Release|Any CPU', 2); this.p('EndGlobalSection', 1); this.p('GlobalSection(ProjectConfigurationPlatforms) = postSolution', 1); this.p('{" + projectUuid.toString().toUpperCase() + "}.Debug|Any CPU.ActiveCfg = Debug|Any CPU', 2); this.p('{" + projectUuid.toString().toUpperCase() + "}.Debug|Any CPU.Build.0 = Debug|Any CPU', 2); this.p('{" + projectUuid.toString().toUpperCase() + "}.Release|Any CPU.ActiveCfg = Release|Any CPU', 2); this.p('{" + projectUuid.toString().toUpperCase() + "}.Release|Any CPU.Build.0 = Release|Any CPU', 2); this.p('EndGlobalSection', 1); this.p('GlobalSection(MonoDevelopProperties) = preSolution', 1); this.p('StartupItem = Project.csproj', 2); this.p('EndGlobalSection', 1); this.p('EndGlobal'); this.closeFile(); } exportResources() { this.createDirectory(path.join(this.options.to, this.sysdir() + '-build', 'shaders')); fs.writeFileSync(path.join(this.options.to, this.sysdir() + '-build', 'shaders', 'Simple.fcg'), 'void main(float4 out Color : COLOR, uniform float4 MaterialColor) {\n' + '\tColor = MaterialColor;\n' + '}\n'); fs.writeFileSync(path.join(this.options.to, this.sysdir() + '-build', 'shaders', 'Simple.vcg'), 'void main(float4 in a_Position : POSITION, float4 out v_Position : POSITION, uniform float4x4 WorldViewProj) {\n' + '\tv_Position = mul(a_Position, WorldViewProj);\n' + '}\n'); fs.writeFileSync(path.join(this.options.to, this.sysdir() + '-build', 'shaders', 'Texture.fcg'), 'void main(float2 in v_TexCoord : TEXCOORD0, float4 out Color : COLOR, uniform sampler2D Texture0 : TEXUNIT0) {\n' + '\tColor = tex2D(Texture0, v_TexCoord);\n' + '}\n'); fs.writeFileSync(path.join(this.options.to, this.sysdir() + '-build', 'shaders', 'Texture.vcg'), 'void main(float4 in a_Position : POSITION, float2 in a_TexCoord : TEXCOORD0, float4 out v_Position : POSITION, float2 out v_TexCoord : TEXCOORD0, uniform float4x4 WorldViewProj) {\n' + '\tv_Position = mul(a_Position, WorldViewProj);\n' + '\tv_TexCoord = a_TexCoord;\n' + '}\n'); let appxml = path.join(this.options.to, this.sysdir() + '-build', 'app.xml'); if (!fs.existsSync(appxml)) { let appxmltext = fs.readFileSync(path.join(__dirname, 'Data', 'psm', 'app.xml'), { encoding: 'utf8' }); fs.writeFileSync(appxml.toString(), appxmltext); } } exportCsProj(projectUuid) { this.writeFile(path.join(this.options.to, this.sysdir() + '-build', 'Project.csproj')); this.p(''); this.p(''); this.p('', 1); this.p('Debug', 2); this.p('AnyCPU', 2); this.p('10.0.0', 2); this.p('2.0', 2); this.p('{' + projectUuid.toString().toUpperCase() + '}', 2); this.p('{69878862-DA7D-4DC6-B0A1-50D8FAB4242F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}', 2); this.p('Exe', 2); this.p('PSTest', 2); this.p('PSTest', 2); this.p('', 1); this.p('', 1); this.p('true', 2); this.p('full', 2); this.p('false', 2); this.p('bin\\Debug', 2); this.p('DEBUG;', 2); this.p('prompt', 2); this.p('4', 2); this.p('false', 2); this.p('', 1); this.p('', 1); this.p('none', 2); this.p('true', 2); this.p('bin\\Release', 2); this.p('prompt', 2); this.p('4', 2); this.p('false', 2); this.p('', 1); this.p('', 1); this.p('', 2); this.p('', 2); this.p('', 2); this.p('', 2); this.p('', 1); this.p('', 1); this.includeFiles(path.join(this.options.to, this.sysdir() + '-build', 'Sources', 'src'), path.join(this.options.to, this.sysdir() + '-build')); this.p('', 1); this.p('', 1); this.p('', 2); this.p('', 2); this.p('', 2); this.p('', 2); this.p('', 1); this.p('', 1); this.p('', 2); this.p('', 1); this.p('', 1); for (let file of this.files) { this.p('', 2); this.p('resources\\' + file.toString() + '', 3); this.p('', 2); } this.p('', 1); this.p('', 1); this.p(''); this.closeFile(); } /*copyMusic(platform, from, to, encoders, callback) { callback(); }*/ async copySound(platform, from, to) { return { files: [''], sizes: [1] }; } async copyImage(platform, from, to, asset, cache) { this.files.push(asset['file']); let format = await (0, ImageTool_1.exportImage)(this.options.kha, this.options.kraffiti, from, path.join(this.options.to, this.sysdir(), to), asset, undefined, false, false, cache); return { files: [to + '.' + format], sizes: [1] }; } async copyBlob(platform, from, to) { fs.copySync(from.toString(), path.join(this.options.to, this.sysdir(), to), { overwrite: true }); this.files.push(to); return { files: [to], sizes: [1] }; } async copyVideo(platform, from, to) { return { files: [''], sizes: [1] }; } } exports.PlayStationMobileExporter = PlayStationMobileExporter; //# sourceMappingURL=PlayStationMobileExporter.js.map