From 0ad820c54715faf01b731a2f55990fcb045a7fbd Mon Sep 17 00:00:00 2001 From: aybe Date: Sun, 13 Oct 2024 03:08:06 +0200 Subject: [PATCH 1/6] Preliminary Wipeout 64 track loading --- .gitignore | 3 ++- .vscode/launch.json | 14 ++++++++++++++ WIPEOUT/TRACK02/README.md | 5 +++++ wipeout.js | 28 +++++++++++++++++----------- 4 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 WIPEOUT/TRACK02/README.md diff --git a/.gitignore b/.gitignore index e5a270a..4f9254b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ WIPEOUT/* !WIPEOUT/README.md WIPEOUT2/* !WIPEOUT2/README.md -soundtrack/* \ No newline at end of file +soundtrack/* +mongoose.exe \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..363f119 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "chrome", + "request": "launch", + "name": "Wipeout Model Viewer", + "url": "http://localhost:8000" + } + ] +} \ No newline at end of file diff --git a/WIPEOUT/TRACK02/README.md b/WIPEOUT/TRACK02/README.md new file mode 100644 index 0000000..a97486e --- /dev/null +++ b/WIPEOUT/TRACK02/README.md @@ -0,0 +1,5 @@ +- this is altima vii - venom +- copy some wipeout 64 level here +- rename sceneSin.* to scene.* +- copy mongoose.exe to root and start it in vscode terminal (https://mongoose.ws/binary/) +- run the vscode debug configuration \ No newline at end of file diff --git a/wipeout.js b/wipeout.js index 7789dd5..818aaa8 100644 --- a/wipeout.js +++ b/wipeout.js @@ -686,9 +686,10 @@ Wipeout.prototype.readImage = function(buffer) { var offset = Wipeout.ImageFileHeader.byteLength; var palette = null; + const type = file.type & 0xF; if( - file.type === Wipeout.IMAGE_TYPE.PALETTED_4_BPP || - file.type === Wipeout.IMAGE_TYPE.PALETTED_8_BPP + type === Wipeout.IMAGE_TYPE.PALETTED_4_BPP || + type === Wipeout.IMAGE_TYPE.PALETTED_8_BPP ) { palette = new Uint16Array(buffer, offset, file.paletteColors); offset += file.paletteColors * 2; @@ -835,21 +836,26 @@ Wipeout.prototype.createTrack = function(files) { var indexEntries = files.textureIndex.byteLength / Wipeout.TrackTextureIndex.byteLength; var textureIndex = Wipeout.TrackTextureIndex.readStructs(files.textureIndex, 0, indexEntries); + var isWipeout64 = true; // TODO as method parameter + + const size1 = isWipeout64 ? 64 : 128; + const size2 = isWipeout64 ? 64 : 32; + const tiles = isWipeout64 ? 1 : 4; + // Extract the big (near) versions of these textures only. The near // version is composed of 4x4 32px tiles. var composedImages = []; - for( var i = 0; i < textureIndex.length; i++ ) { - var idx = textureIndex[i]; + for( var i = 0; i < (isWipeout64 ? images.length : textureIndex.length); i++ ) { + var idx = isWipeout64 ? undefined : textureIndex[i]; var composedImage = document.createElement('canvas'); - composedImage.width = 128; - composedImage.height = 128; + composedImage.width = size1; + composedImage.height = size1; var ctx = composedImage.getContext('2d'); - - for( var x = 0; x < 4; x++ ) { - for( var y = 0; y < 4; y++ ) { - var image = images[idx.near[y * 4 + x]]; - ctx.drawImage(image, x*32, y*32) + for( var x = 0; x < tiles; x++ ) { + for( var y = 0; y < tiles; y++ ) { + var image = isWipeout64 ? images[i] : images[idx.near[y * 4 + x]]; + ctx.drawImage(image, x*size2, y*size2) } } composedImages.push(composedImage); From 12fd4dd9758de3da9f6bfc8c8ece7324a89a6bf4 Mon Sep 17 00:00:00 2001 From: Tigrou Ind Date: Sun, 13 Oct 2024 17:41:57 +0200 Subject: [PATCH 2/6] Load additional scene files --- wipeout.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/wipeout.js b/wipeout.js index 818aaa8..8b28d89 100644 --- a/wipeout.js +++ b/wipeout.js @@ -1025,10 +1025,20 @@ Wipeout.prototype.getSectionPosition = function(section, faces, vertices) { Wipeout.prototype.loadTrack = function( path, loadTEXFile ) { var that = this; this.loadBinaries({ - textures: path+'/SCENE.CMP', - objects: path+'/SCENE.PRM' + textures: path+'/sceneCom.CMP', + objects: path+'/sceneCom.PRM' }, function(files) { that.createScene(files); }); + this.loadBinaries({ + textures: path+'/sceneSin.CMP', + objects: path+'/sceneSin.PRM' + }, function(files) { that.createScene(files); }); + + /*this.loadBinaries({ + textures: path+'/sceneMul.CMP', + objects: path+'/sceneMul.PRM' + }, function(files) { that.createScene(files); });*/ + this.loadBinaries({ textures: path+'/SKY.CMP', objects: path+'/SKY.PRM' From e0bd4fd15b8d630def279e4101fae47e153ee147 Mon Sep 17 00:00:00 2001 From: Tigrou Ind Date: Sun, 13 Oct 2024 17:42:24 +0200 Subject: [PATCH 3/6] Fix 4 bpp texture (type = 0x72) not loaded --- wipeout.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wipeout.js b/wipeout.js index 8b28d89..3a5924d 100644 --- a/wipeout.js +++ b/wipeout.js @@ -697,10 +697,10 @@ Wipeout.prototype.readImage = function(buffer) { offset += 4; // skip data size var pixelsPerShort = 1; - if( file.type === Wipeout.IMAGE_TYPE.PALETTED_8_BPP ) { + if( type === Wipeout.IMAGE_TYPE.PALETTED_8_BPP ) { pixelsPerShort = 2; } - else if( file.type === Wipeout.IMAGE_TYPE.PALETTED_4_BPP ) { + else if( type === Wipeout.IMAGE_TYPE.PALETTED_4_BPP ) { pixelsPerShort = 4; } @@ -724,13 +724,13 @@ Wipeout.prototype.readImage = function(buffer) { } var entries = dim.width * dim.height; - if( file.type === Wipeout.IMAGE_TYPE.TRUE_COLOR_16_BPP ) { + if( type === Wipeout.IMAGE_TYPE.TRUE_COLOR_16_BPP ) { for( var i = 0; i < entries; i++ ) { var c = data.getUint16(offset+i*2, true); putPixel(pixels.data, i*4, c); } } - else if( file.type === Wipeout.IMAGE_TYPE.PALETTED_8_BPP ) { + else if( type === Wipeout.IMAGE_TYPE.PALETTED_8_BPP ) { for( var i = 0; i < entries; i++ ) { var p = data.getUint16(offset+i*2, true); @@ -738,7 +738,7 @@ Wipeout.prototype.readImage = function(buffer) { putPixel(pixels.data, i*8+4, palette[ (p>>8) & 0xff ]); } } - else if( file.type === Wipeout.IMAGE_TYPE.PALETTED_4_BPP ) { + else if( type === Wipeout.IMAGE_TYPE.PALETTED_4_BPP ) { for( var i = 0; i < entries; i++ ) { var p = data.getUint16(offset+i*2, true); From caf0a34213282a6f20b63af5aec26d2c2e161b33 Mon Sep 17 00:00:00 2001 From: Tigrou Ind Date: Sun, 13 Oct 2024 18:21:08 +0200 Subject: [PATCH 4/6] Increase skybox size --- wipeout.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wipeout.js b/wipeout.js index 3a5924d..d149284 100644 --- a/wipeout.js +++ b/wipeout.js @@ -1042,7 +1042,7 @@ Wipeout.prototype.loadTrack = function( path, loadTEXFile ) { this.loadBinaries({ textures: path+'/SKY.CMP', objects: path+'/SKY.PRM' - }, function(files) { that.createScene(files, {scale:48}); }); + }, function(files) { that.createScene(files, {scale:64}); }); var trackFiles = { From 32582a448899b180c2ef6f80b6ef8d8841f3a0c2 Mon Sep 17 00:00:00 2001 From: Tigrou Ind Date: Sun, 13 Oct 2024 18:40:20 +0200 Subject: [PATCH 5/6] Add Wipeout 64 tracks to main dropdown --- .gitignore | 2 ++ WIPEOUT/TRACK02/README.md | 5 ---- index.html | 12 +++++++++ wipeout.js | 53 ++++++++++++++++++++++++++------------- 4 files changed, 49 insertions(+), 23 deletions(-) delete mode 100644 WIPEOUT/TRACK02/README.md diff --git a/.gitignore b/.gitignore index 4f9254b..43ced3f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,7 @@ WIPEOUT/* !WIPEOUT/README.md WIPEOUT2/* !WIPEOUT2/README.md +WIPEOUT64/* +!WIPEOUT64/README.md soundtrack/* mongoose.exe \ No newline at end of file diff --git a/WIPEOUT/TRACK02/README.md b/WIPEOUT/TRACK02/README.md deleted file mode 100644 index a97486e..0000000 --- a/WIPEOUT/TRACK02/README.md +++ /dev/null @@ -1,5 +0,0 @@ -- this is altima vii - venom -- copy some wipeout 64 level here -- rename sceneSin.* to scene.* -- copy mongoose.exe to root and start it in vscode terminal (https://mongoose.ws/binary/) -- run the vscode debug configuration \ No newline at end of file diff --git a/index.html b/index.html index 98d9677..24b0e47 100644 --- a/index.html +++ b/index.html @@ -171,7 +171,19 @@ }, function(files) { viewer.createScene(files, {scale: 16, space:20000}); }); }); + addOption(groupWipeout2097, '', function(){}); + + // WipEout 64 + var groupWipeout64 = addGroup(select, 'WipEout 64'); + + for( var i = 0; i < Wipeout.Tracks.Wipeout64.length; i++ ) { + var track = Wipeout.Tracks.Wipeout64[i]; + addOption(groupWipeout64, track.name, (function(track, viewer){ + viewer.clear(); + viewer.loadTrack(track.path, track.hasTEXFile, track.isWipeout64); + }).bind(null, track)); + } // Camera and Music Controls document.getElementById('freeCam').addEventListener('click', function(ev){ diff --git a/wipeout.js b/wipeout.js index d149284..9172048 100644 --- a/wipeout.js +++ b/wipeout.js @@ -828,7 +828,7 @@ Wipeout.prototype.createScene = function(files, modify) { // ---------------------------------------------------------------------------- // Add a track from TRV, TRF, CMP and TTF files to the scene -Wipeout.prototype.createTrack = function(files) { +Wipeout.prototype.createTrack = function(files, isWipeout64) { var rawImages = this.unpackImages(files.textures); var images = rawImages.map(this.readImage.bind(this)); @@ -836,8 +836,6 @@ Wipeout.prototype.createTrack = function(files) { var indexEntries = files.textureIndex.byteLength / Wipeout.TrackTextureIndex.byteLength; var textureIndex = Wipeout.TrackTextureIndex.readStructs(files.textureIndex, 0, indexEntries); - var isWipeout64 = true; // TODO as method parameter - const size1 = isWipeout64 ? 64 : 128; const size2 = isWipeout64 ? 64 : 32; const tiles = isWipeout64 ? 1 : 4; @@ -1022,22 +1020,31 @@ Wipeout.prototype.getSectionPosition = function(section, faces, vertices) { -Wipeout.prototype.loadTrack = function( path, loadTEXFile ) { +Wipeout.prototype.loadTrack = function( path, loadTEXFile, isWipeout64 ) { var that = this; - this.loadBinaries({ - textures: path+'/sceneCom.CMP', - objects: path+'/sceneCom.PRM' - }, function(files) { that.createScene(files); }); - this.loadBinaries({ - textures: path+'/sceneSin.CMP', - objects: path+'/sceneSin.PRM' - }, function(files) { that.createScene(files); }); - - /*this.loadBinaries({ - textures: path+'/sceneMul.CMP', - objects: path+'/sceneMul.PRM' - }, function(files) { that.createScene(files); });*/ + if (isWipeout64) { + this.loadBinaries({ + textures: path+'/sceneCom.CMP', + objects: path+'/sceneCom.PRM' + }, function(files) { that.createScene(files); }); + + this.loadBinaries({ + textures: path+'/sceneSin.CMP', + objects: path+'/sceneSin.PRM' + }, function(files) { that.createScene(files); }); + + /*this.loadBinaries({ + textures: path+'/sceneMul.CMP', + objects: path+'/sceneMul.PRM' + }, function(files) { that.createScene(files); });*/ + } + else { + this.loadBinaries({ + textures: path+'/scene.CMP', + objects: path+'/scene.PRM' + }, function(files) { that.createScene(files); }); + } this.loadBinaries({ textures: path+'/SKY.CMP', @@ -1057,7 +1064,7 @@ Wipeout.prototype.loadTrack = function( path, loadTEXFile ) { trackFiles.trackTexture = path+'/TRACK.TEX'; } - this.loadBinaries(trackFiles, function(files) { that.createTrack(files); }); + this.loadBinaries(trackFiles, function(files) { that.createTrack(files, isWipeout64); }); }; @@ -1090,3 +1097,13 @@ Wipeout.Tracks.Wipeout2097 = [ {path: "WIPEOUT2/TRACK07", name: "Spilskinanke", hasTEXFile: true}, {path: "WIPEOUT2/TRACK04", name: "Unfinished Track"}, ]; + +Wipeout.Tracks.Wipeout64 = [ + {path: "WIPEOUT64/TRACK01", name: "Klies Bridge", isWipeout64: true}, + {path: "WIPEOUT64/TRACK02", name: "Qoron IV", isWipeout64: true}, + {path: "WIPEOUT64/TRACK03", name: "Sokana", isWipeout64: true}, + {path: "WIPEOUT64/TRACK04", name: "Dyroness", isWipeout64: true}, + {path: "WIPEOUT64/TRACK05", name: "Machaon II", isWipeout64: true}, + {path: "WIPEOUT64/TRACK06", name: "Terafumos", isWipeout64: true}, + {path: "WIPEOUT64/TRACK07", name: "Velocitar", isWipeout64: true} +]; From 5106558ed9953b4a6e1258e7c33eb54e8bf649f2 Mon Sep 17 00:00:00 2001 From: Tigrou Ind Date: Sun, 13 Oct 2024 18:21:08 +0200 Subject: [PATCH 6/6] Remove skybox + add WIPEOUT64 folder + cleanup --- .gitignore | 3 ++- .vscode/launch.json | 14 -------------- WIPEOUT64/README.md | 1 + wipeout.js | 11 +++++------ 4 files changed, 8 insertions(+), 21 deletions(-) delete mode 100644 .vscode/launch.json create mode 100644 WIPEOUT64/README.md diff --git a/.gitignore b/.gitignore index 43ced3f..d275691 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ WIPEOUT2/* WIPEOUT64/* !WIPEOUT64/README.md soundtrack/* -mongoose.exe \ No newline at end of file +mongoose* +.vscode/* \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 363f119..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "chrome", - "request": "launch", - "name": "Wipeout Model Viewer", - "url": "http://localhost:8000" - } - ] -} \ No newline at end of file diff --git a/WIPEOUT64/README.md b/WIPEOUT64/README.md new file mode 100644 index 0000000..49a8d17 --- /dev/null +++ b/WIPEOUT64/README.md @@ -0,0 +1 @@ +Copy files extracted from WipEout 64 rom diff --git a/wipeout.js b/wipeout.js index 9172048..fa76f77 100644 --- a/wipeout.js +++ b/wipeout.js @@ -1044,14 +1044,13 @@ Wipeout.prototype.loadTrack = function( path, loadTEXFile, isWipeout64 ) { textures: path+'/scene.CMP', objects: path+'/scene.PRM' }, function(files) { that.createScene(files); }); + + this.loadBinaries({ + textures: path+'/SKY.CMP', + objects: path+'/SKY.PRM' + }, function(files) { that.createScene(files, {scale:48}); }); } - this.loadBinaries({ - textures: path+'/SKY.CMP', - objects: path+'/SKY.PRM' - }, function(files) { that.createScene(files, {scale:64}); }); - - var trackFiles = { textures: path+'/LIBRARY.CMP', textureIndex: path+'/LIBRARY.TTF',