Skip to content

Commit

Permalink
第四步
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosabis committed Mar 8, 2023
1 parent 135f818 commit 1ff9117
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 34 deletions.
6 changes: 3 additions & 3 deletions bld/j2me.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @const */ var release = false;
*/
/** @const */ var release = true;
/** @const */ var profile = 0;
/** @const */ var profileFormat = "PLAIN";
/** @const */ var asmJsTotalMemory = 8192 * 1024 * 1024;
Expand Down Expand Up @@ -9190,7 +9190,7 @@ var J2ME;
return classInfo;
};
ClassRegistry.prototype.loadClassFile = function (fileName) {
console.log("Loading Class File: "+fileName);
//console.log("Loading Class File: "+fileName);
J2ME.loadWriter && J2ME.loadWriter.enter("> Loading Class File: " + fileName);
var bytes = JARStore.loadFile(fileName);
//console.log(bytes)
Expand Down
16 changes: 13 additions & 3 deletions bld/main-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
//1是pAudio
//2是webaudio-tinysynth
var midimode=2;
window.AudioContext = window.AudioContext || window.webkitAudioContext
if(!window.AudioContext)
{
window.AudioContext = function(){

};
}

if (inBrowser && !HTMLCanvasElement.prototype.toBlob) {
Object.defineProperty(HTMLCanvasElement.prototype, "toBlob", {value:function(callback, type, quality) {
Expand Down Expand Up @@ -4019,7 +4026,7 @@ var initFS = (new Promise(function(resolve, reject) {
define = function(ids, factory) {
deps = typeof ids === "string" ? factory.slice(2) : ids.slice(2);
if (nodeJS) {
delete define;
//delete define;
return tmpDefine.apply(null, Array.prototype.slice.call(arguments, 0));
}
define = tmpDefine;
Expand Down Expand Up @@ -4202,7 +4209,7 @@ var initFS = (new Promise(function(resolve, reject) {
define = function(ids, factory) {
deps = typeof ids === "string" ? factory.slice(2) : ids.slice(2);
if (nodeJS) {
delete define;
//delete define;
return tmpDefine.apply(null, Array.prototype.slice.call(arguments, 0));
}
define = tmpDefine;
Expand Down Expand Up @@ -12025,7 +12032,6 @@ function PlayerContainer(url, pId) {
this.loadSize = 0;
this.data = null;
this.player = null;
window.AudioContext = window.AudioContext || window.webkitAudioContext
this.audioCtx = new AudioContext()
if(midimode==1)
{
Expand Down Expand Up @@ -13279,6 +13285,7 @@ document.getElementById("fire").onmouseup = function() {
MIDP.sendKeyRelease(32);
};
*/

var Location = {};
Location.PROVIDER_NAME = "browser";
Location.Providers = {};
Expand Down Expand Up @@ -13397,6 +13404,7 @@ var createLongArrayFromDoubles = function() {
}();
AccelerometerSensor.channels = [{scale:0, name:"axis_x", unit:"m/s^2", dataType:1, accuracy:1, mrangeArray:createLongArrayFromDoubles([-19.6, 19.6, .153])}, {scale:0, name:"axis_y", unit:"m/s^2", dataType:1, accuracy:1, mrangeArray:createLongArrayFromDoubles([-19.6, 19.6, .153])}, {scale:0, name:"axis_z", unit:"m/s^2", dataType:1, accuracy:1, mrangeArray:createLongArrayFromDoubles([-19.6, 19.6, .153])}];
AccelerometerSensor.simulator = {_intervalId:-1, start:function() {

var currentMouseX = -1;
var currentMouseY = -1;
var c = MIDP.deviceContext.canvas;
Expand Down Expand Up @@ -14242,6 +14250,7 @@ perfWriterCheckbox.addEventListener("change", function() {
J2ME.writers &= !J2ME.WriterFlags.Perf;
}
});

var profiler = profile === 1 ? function() {
var elPageContainer = document.getElementById("pageContainer");
elPageContainer.classList.add("profile-mode");
Expand Down Expand Up @@ -14327,3 +14336,4 @@ var profiler = profile === 1 ? function() {
}() : undefined;

//# sourceMappingURL=main-all.js.map

2 changes: 1 addition & 1 deletion config/build.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// generated, build-specific configuration

config.release = false;
config.release = true;
config.version = "1659142910";
45 changes: 23 additions & 22 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
<title>j2me在线模拟器</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">

<script type="text/javascript" src="libs/axios.min.js"></script>

<!-- Required for non-UTF encodings -->
<script src="libs/encoding-indexes.js"></script>

<!-- Required for non-UTF encodings -->
<script src="libs/encoding.js"></script>
<!-- Load config scripts separately because compiled-method-cache.js
- depends on them. -->
Expand Down Expand Up @@ -293,7 +290,7 @@ <h1 class="download-dialog-text">Download failure</h1>
},
(err)=>{
alert(err);
},
}
);
}

Expand All @@ -311,7 +308,7 @@ <h1 class="download-dialog-text">Download failure</h1>
alert("请选择jar名称!");
return;
}
var jarname = localjars.options[localjars.selectedIndex].innerText;
var jarname = localjars.options[localjars.selectedIndex].text;
console.log(jarname);
openJar(jarname,"",1);

Expand All @@ -332,7 +329,7 @@ <h1 class="download-dialog-text">Download failure</h1>
alert("请选择jar名称!");
return;
}
var jarname = localjars.options[localjars.selectedIndex].innerText;
var jarname = localjars.options[localjars.selectedIndex].text;
console.log(jarname);
let res = confirm('确定删除 '+jarname+' ?');
if(res)
Expand All @@ -349,7 +346,7 @@ <h1 class="download-dialog-text">Download failure</h1>
);
}
}
var onUploadFile = async (e) => {
var onUploadFile = function(e){
const _files = e.target.files;
if (_files.length == 0) {
return;
Expand All @@ -361,17 +358,21 @@ <h1 class="download-dialog-text">Download failure</h1>
return;
}
//fs.createUniqueFile("/Phone",_file.name,_file);
JARStore.installJAR(_file.name,await _file.arrayBuffer()).then
(
()=>{
alert(_file.name+"安装成功!");
refreshGameList();
},
(errname)=>{
alert(errname+"安装失败!");
}
);
document.getElementById("jarFileupload").value= null;
const reader = new FileReader();
reader.readAsArrayBuffer(_file);
reader.onload = function(readRes){
JARStore.installJAR(_file.name,readRes.target.result).then
(
()=>{
alert(_file.name+"安装成功!");
refreshGameList();
},
(errname)=>{
alert(errname+"安装失败!");
}
);
document.getElementById("jarFileupload").value= null;
}
}

var config = function() {
Expand Down Expand Up @@ -437,10 +438,10 @@ <h1 class="download-dialog-text">Download failure</h1>
{
//var mycheck1=document.getElementById('mycheck1');
//var mycheck2=document.getElementById('mycheck2');
var href='index2.html?jars=jar/'+jarname+'&jad=&midletClassName='+midletClassName;
var href='main.html?jars=jar/'+jarname+'&jad=&midletClassName='+midletClassName;
if(islocaljar)
{
href='index2.html?localjar='+jarname;
href='main.html?localjar='+jarname;
}
//if(mycheck1.checked)
//{
Expand Down
3 changes: 3 additions & 0 deletions jar/kemulator.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#KEmulator platforms
#Fri Feb 17 17:42:50 CST 2023
ddz=Nokia N71
52 changes: 51 additions & 1 deletion libs/encoding.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions main.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

<script src="./libs/jsgraphics.js" type="text/javascript"></script>

<!-- Required for non-UTF encodings -->
<script src="libs/encoding-indexes.js"></script>
<!-- Required for non-UTF encodings -->
<script src="libs/encoding.js"></script>
<!-- Load config scripts separately because compiled-method-cache.js
- depends on them. -->
Expand Down
2 changes: 1 addition & 1 deletion manifest.webapp
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@
}
}
},
"type": "privileged"
"type": "web"
}
26 changes: 25 additions & 1 deletion updatelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,31 @@
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
</head>
<body>
2023-3-8 18:05
</br>
修复audiocontext兼容性,使其兼容旧版ios。
</br>
</br>

2023-2-25 19:18
</br>
修改index2为main,以兼容按键操作,兼容kaios设备的按键。
</br>
</br>

2023-2-25 18:33
</br>
修复老safari兼容性。
</br>
</br>

2023-2-25 17:51
</br>
修复火狐48的兼容性问题,火狐48的midi播放有问题。
删除axios的引用。
</br>
</br>

2023-2-21 16:46
</br>
新增游戏:植物大战僵尸(英文原版)。
Expand All @@ -24,7 +49,6 @@
优化兼容性,现已经可以运行天天动听和qq音乐。
</br>
</br>

2023-2-19 06:27
</br>
增加支持amr格式和mp3格式的声音,修复某些游戏的按键bug。
Expand Down

0 comments on commit 1ff9117

Please sign in to comment.