Git Product home page Git Product logo

athenaenv's Introduction

Hi there! I'm Daniel Santos πŸ‘‹

Affiliations

  • Junior Software Engineer at Jusbrasil.
  • Data Science and Artificial Intelligence Undergraduate at UFPB.

Past experiences

  • Full stack development intern at TCE-PB.
  • Software Engineer Intern at Jusbrasil.

Personal

  • Developing Athena: A complete JavaScript OS layer for the PlayStation 2.
  • Homebrew retrogaming scene regular contributor. Libraries, apps, games, mods and more :D
  • Reverse Engineering Addict: Understanding how things are done is also a part of enjoying them.
  • Funfact: I love working with game-related stuff, but not necessarily playing.

html css js ts python asm c cplusplus lua scala java msdos markdown

angular git arduino gcc numpy pandas nodejs ogl react nextjs sass npm nginx jquery docker

athenaenv's People

Contributors

danielsant0s avatar fjtrujy avatar guiprav avatar israpps avatar jcnmsg avatar maraleao avatar vinicgobbi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

athenaenv's Issues

Enhance audio module

To do

  • Reorganize code
  • Increase ring buffer - that could achieve a better performance

Pads.Rumble freezes my PS2

If I press r2+l2 to test the rumble on the pad tester it freezes (fps does not update, can not seem to do any inputs anymore)
had it in my own code and it was just launching to a black screen, now I know why^

using the latest release on git and launched athena.elf from a usb in wlaunchelf 4.43 (samba app from opl doesnt seem to work)
My PS2 is a Slim SCPH-70004 PAL and also using a original ps2 controller.

Any clues?

Dando tela preta no ps2 real

Quando eu abro o Athena.ELF no Ulanchelf ele fica com tela preta como fasso pra arrumar e fazer ele funciona? Nenhum dos ELF funciona (que estΓ£o na pasta que tu disponibilizou o download).

Keyboard Module

The keyboard module is somewhat broken; some keys don't work. It would be great to have a function to change the keyboard language, and it's also unable to detect certain keys like control, shift, the Windows button, Alt, and others.

Blank screen on actual hardware using uLE 4.42d

Sorry to open yet another issue but have you had any luck running Athena projects on actual hardware? I have a FAT SCPH 39004 (PAL) and I'm running uLE 4.42d but every time I open the .elf file I see nothing but a blank screen. My TV displays both PAL and NTSC signals so that's not it.

This is the project I'm trying to run but I also tried the code from #4 and the demo included with this repository and neither of them run, they just hang on a blank screen.

Is there anything I'm missing or are there any extra steps to running this on real hardware other than launching the .elf file?

How do we have two audio streams

I have tried to make two audio streams using wav. One is for music and the other for sounds. I have separated the functions but anytime you play a sound it cancels out the music and then stalls all audio altogether. Thanks.

`

IOP.loadDefaultModule(IOP.keyboard);
Keyboard.init();

let bg = new Image("SWTC/LVL_PS2/Menu/background.png");
let menu_box_mesh = new Image("SWTC/LVL_PS2/Menu/menu_box_mesh.png");
let build = "Development Build 2";
let build_date = "3/29/2024";
let program_status = "menu";
let menu_option = 1;
var menu_text_animation = 32;

var unsel_color = Color.new(255, 255, 255, 64);
var sel_color = Color.new(17,49,255, 32);

let font = new Font("SWTC/LVL_PS2/Menu/CONSOLAB.TTF");
let font_medium = new Font("SWTC/LVL_PS2/Menu/CONSOLAB.TTF");
let font_bold = new Font("SWTC/LVL_PS2/Menu/CONSOLAB.TTF");
font.color = unsel_color;
font_bold.scale = 0.7f
font_medium.scale = 1.0f;
font.scale = 0.44f;
let font_text_box = new Font("SWTC/LVL_PS2/Menu/CONSOLAB.TTF")
let font_text_box_selected = new Font("SWTC/LVL_PS2/Menu/CONSOLAB.TTF")
font_text_box_selected.color = sel_color;
let font_animation_sequence = 1;

function random(max) {

return Math.floor(Math.random() * max + 1);

}

let music_stream_timer = Timer.new();
let sound_stream_timer = Timer.new();
let music_stream = Sound.load("SWTC/LVL_PS2/Music/Menu" + random(3) + ".wav");
let sound_stream = Sound.load("SWTC/LVL_PS2/Sounds/back.wav");
let music_stream_duration;
let sound_stream_duration;
let local_duration = (Math.floor(Timer.getTime(music_stream_timer)));
let local_sound_duration = (Math.floor(Timer.getTime(sound_stream_timer)));

//Music

music_stream_duration = Sound.duration(music_stream);
Sound.play(music_stream);
Timer.reset(music_stream_timer);

sound_stream_duration = Sound.duration(sound_stream);
Sound.play(sound_stream);
Timer.reset(sound_stream_timer);

let menu_ptr = 0;

let new_pad = Pads.get();
let old_pad = new_pad;

let old_kbd_char = 0;
let kbd_char = 0;

const VK_OLD_UP = 27;
const VK_NEW_UP = 44;
const VK_OLD_DOWN = 27;
const VK_NEW_DOWN = 43;
const VK_RETURN = 10;

var ee_info = System.getCPUInfo();

function textAnimation(interval,integer) {

if(font_animation_sequence === 1) {
integer = integer + interval;
} else {
integer = integer - interval;
}

if(integer === 99) {
font_animation_sequence = 2;

}

if(integer === 31) {
font_animation_sequence = 1;

}

return integer;

}

function optionCeiling(numOfOptions,compare) {

if(compare > numOfOptions) {
compare = 1;
}

if(compare === 0) {
compare = numOfOptions;
}

return compare;

}

function print(posx, posy, text, type) {

if(type === "text_box") {

font_text_box_selected.print(posx, posy, text);
} else {

if(type === "") {

font_text_box.print(posx, posy, text);
}

}

}

function text_button(posx, posy, image, text, id) {

if(image === "menu_box_mesh") {

menu_box_mesh.draw(posx,posy);
menu_box_mesh.width = 150;
menu_box_mesh.height = 30;

}

function play_sound(sound) {

switch(sound){

case "select":

local_sound_duration = 0;

break;

}

}

if(menu_option === id) {
print(posx,posy,text,"text_box");
} else {
print(posx,posy,text,"");
}
}

function image_button(posx, posy, image) {

}

os.setInterval(() => {

old_pad = new_pad;
new_pad = Pads.get();

old_kbd_char = kbd_char;
kbd_char = Keyboard.get();

Screen.clear();

if(program_status === "menu") {

if(local_duration >= music_stream_duration) {
local_duration = 0;
Sound.pause(music_stream);
let new_music_stream = Sound.load("SWTC/LVL_PS2/Music/Menu" + random(3) + ".wav");
music_stream_duration = Sound.duration(new_music_stream);
Timer.reset(music_stream_timer);
Sound.play(new_music_stream);
let old_music_stream = music_stream;
music_stream = new_music_stream;
Sound.free(old_music_stream);
}

local_duration = (Math.floor(Timer.getTime(music_stream_timer)));
local_sound_duration = (Math.floor(Timer.getTime(sound_stream_timer)));
print(30,30,"ld" + local_duration,"text_box");
print(30,50,"md" + music_stream_duration,"text_box");
print(30,90,"ld" + local_sound_duration,"text_box");
print(30,140,"md" + sound_stream_duration,"text_box");
menu_text_animation = textAnimation(4,menu_text_animation);

font_text_box_selected.color = Color.new(17,49,255,menu_text_animation);;

print(10,10,menu_option,"");
menu_option = optionCeiling(3,menu_option);

text_button(190, 125, "menu_box_mesh", "Campaign",1);
text_button(190, 125+45, "menu_box_mesh", "Options",2);
text_button(190, 125+45*2, "menu_box_mesh", "Exit Game",3);

bg.draw(0, 0);

print(15, 5, "Star Wars Tactical Command" + build + "" + build_date,"");


if(Pads.check(new_pad, Pads.UP) && !Pads.check(old_pad, Pads.UP) || old_kbd_char == VK_OLD_UP && kbd_char == VK_NEW_UP) {

menu_option = menu_option - 1;

let new_sound_stream = Sound.load("SWTC/LVL_PS2/Sounds/select.wav");
sound_stream_duration = Sound.duration(new_sound_stream);
Timer.reset(sound_stream_timer);
Sound.play(new_sound_stream);
Sound.resume(music_stream);
let old_sound_stream = sound_stream;
sound_stream = new_sound_stream;
Sound.free(old_sound_stream);

}

if(Pads.check(new_pad, Pads.DOWN) && !Pads.check(old_pad, Pads.DOWN) || old_kbd_char == VK_OLD_DOWN && kbd_char == VK_NEW_DOWN){

menu_option = menu_option + 1;

Sound.play(select);

}

if(Pads.check(new_pad, Pads.CROSS) && !Pads.check(old_pad, Pads.CROSS) || kbd_char == VK_RETURN){

Sound.play(affirm);

  }
  
  
  if(Pads.check(new_pad, Pads.CIRCLE) && !Pads.check(old_pad, Pads.CIRCLE)){

Sound.play(back);

  }

}

Screen.flip();

}, 0);

`

Enhance VM state control

To be possible more than 1 instance for multithreading and many contexts or context reset to an eventual script reset

Please create a version with ISO9660 file naming.

This technically isn't that important, but I feel it would be very easy for you to do so I'm asking anyway. Could you create a version of this with all the file and folder names in all capital letters, with no spaces? I'm creating a PS2 game as a passion project, and this file naming scheme is required to burn the game to a real, physical DVD.

I know I could just keep it as an ELF program, but I'd really like to be able to burn it if possible.

Thanks.

Enceladus

Will Enceladus ever be updated to match the features of this environment? I think this setup is really impressive but for some of us, programming in Lua is better. Other than that amazing project.

[QUESTION] Alternative to `f` suffix on single floats

From the README:

This project introduces a (old)new data type for JavaScript: single floats. Despite being less accurate than the classic doubles for number semantics, they are important for performance on the PS2, as the console only processes 32-bit floats on its FPU.
You can write single floats on AthenaEnv following the syntax below:

let test_float = 15.0f; // The 'f' suffix makes QuickJS recognizes it as a single float.

While I get the reason behind it, I'd like to mention that this approach breaks JavaScript tools such as ESLint and Prettier.

Of course, these tools are not critical but it'd be nice to have them (and possibly others like TypeScript) supported like in any other JavaScript project. I Google'd a bit and discovered the Math.fround method, which:

returns the nearest 32-bit single precision float representation of a number

In the same page, it mentions that:

JavaScript continues to treat the number as a 64-bit float, it just performs a "round to even" on the 23rd bit of the mantissa, and sets all following mantissa bits to 0.

As I'm not so familiar with single floats and lower-level languages, I was wondering if you have explored this approach as a replacement for the f suffix and if there are any drawbacks.

I tried using this method in the dashboard and pong files which then could be formatted by Prettier for example. I didn't see an increase of memory usage but as the demos are simple, that's probably not a valid test case.

How do we have two audio streams

I have tried to make two audio streams using wav. One is for music and the other for sounds. I have separated the functions but anytime you play a sound it cancels out the music and then stalls all audio altogether. Thanks.

`

IOP.loadDefaultModule(IOP.keyboard);
Keyboard.init();











let bg = new Image("SWTC/LVL_PS2/Menu/background.png");
let menu_box_mesh = new Image("SWTC/LVL_PS2/Menu/menu_box_mesh.png");
let build = "Development Build 2";
let build_date = "3/29/2024";
let program_status = "menu";
let menu_option = 1;
var menu_text_animation = 32;

var unsel_color = Color.new(255, 255, 255, 64);
var sel_color = Color.new(17,49,255, 32);

let font = new Font("SWTC/LVL_PS2/Menu/CONSOLAB.TTF");
let font_medium = new Font("SWTC/LVL_PS2/Menu/CONSOLAB.TTF");
let font_bold = new Font("SWTC/LVL_PS2/Menu/CONSOLAB.TTF");
font.color = unsel_color;
font_bold.scale = 0.7f
font_medium.scale = 1.0f;
font.scale = 0.44f;
let font_text_box = new Font("SWTC/LVL_PS2/Menu/CONSOLAB.TTF")
let font_text_box_selected = new Font("SWTC/LVL_PS2/Menu/CONSOLAB.TTF")
font_text_box_selected.color = sel_color;
let font_animation_sequence = 1;

function random(max) {

return Math.floor(Math.random() * max + 1);

}


let music_stream_timer = Timer.new();
let sound_stream_timer = Timer.new();
let music_stream = Sound.load("SWTC/LVL_PS2/Music/Menu" + random(3) + ".wav");
let sound_stream = Sound.load("SWTC/LVL_PS2/Sounds/back.wav");
let music_stream_duration;
let sound_stream_duration;
let local_duration = (Math.floor(Timer.getTime(music_stream_timer)));
let local_sound_duration = (Math.floor(Timer.getTime(sound_stream_timer)));


//Music


music_stream_duration = Sound.duration(music_stream);
Sound.play(music_stream);
Timer.reset(music_stream_timer);

sound_stream_duration = Sound.duration(sound_stream);
Sound.play(sound_stream);
Timer.reset(sound_stream_timer);





let menu_ptr = 0;

let new_pad = Pads.get();
let old_pad = new_pad;

let old_kbd_char = 0;
let kbd_char = 0;

const VK_OLD_UP = 27;
const VK_NEW_UP = 44;
const VK_OLD_DOWN = 27;
const VK_NEW_DOWN = 43;
const VK_RETURN = 10;

var ee_info = System.getCPUInfo();


function textAnimation(interval,integer) {

if(font_animation_sequence === 1) {
integer = integer + interval;
} else {
integer = integer - interval;
}

if(integer === 99) {
font_animation_sequence = 2;


}

if(integer === 31) {
font_animation_sequence = 1;

}

return integer;


}


function optionCeiling(numOfOptions,compare) {

if(compare > numOfOptions) {
compare = 1;
}

if(compare === 0) {
compare = numOfOptions;
}

return compare;

}

function print(posx, posy, text, type) {

if(type === "text_box") {

font_text_box_selected.print(posx, posy, text);
} else {

if(type === "") {

font_text_box.print(posx, posy, text);
}

}

}


function text_button(posx, posy, image, text, id) {

if(image === "menu_box_mesh") {

menu_box_mesh.draw(posx,posy);
menu_box_mesh.width = 150;
menu_box_mesh.height = 30;


}



function play_sound(sound) {

switch(sound){

case "select":

local_sound_duration = 0;


break;

}

}


if(menu_option === id) {
print(posx,posy,text,"text_box");
} else {
print(posx,posy,text,"");
}
}



function image_button(posx, posy, image) {

 
}






os.setInterval(() => {


    old_pad = new_pad;
    new_pad = Pads.get();

    old_kbd_char = kbd_char;
    kbd_char = Keyboard.get();

    Screen.clear();
	
	if(program_status === "menu") {
	
	
	 


if(local_duration >= music_stream_duration) {
local_duration = 0;
Sound.pause(music_stream);
let new_music_stream = Sound.load("SWTC/LVL_PS2/Music/Menu" + random(3) + ".wav");
music_stream_duration = Sound.duration(new_music_stream);
Timer.reset(music_stream_timer);
Sound.play(new_music_stream);
let old_music_stream = music_stream;
        music_stream = new_music_stream;
        Sound.free(old_music_stream);
}


local_duration = (Math.floor(Timer.getTime(music_stream_timer)));
local_sound_duration = (Math.floor(Timer.getTime(sound_stream_timer)));
print(30,30,"ld" + local_duration,"text_box");
print(30,50,"md" + music_stream_duration,"text_box");
print(30,90,"ld" + local_sound_duration,"text_box");
print(30,140,"md" + sound_stream_duration,"text_box");
	menu_text_animation = textAnimation(4,menu_text_animation);


	font_text_box_selected.color = Color.new(17,49,255,menu_text_animation);;
	
	print(10,10,menu_option,"");
	menu_option = optionCeiling(3,menu_option);
text_button(190, 125, "menu_box_mesh", "Campaign",1);
text_button(190, 125+45, "menu_box_mesh", "Options",2);
text_button(190, 125+45*2, "menu_box_mesh", "Exit Game",3);



    bg.draw(0, 0);

    print(15, 5, "Star Wars Tactical Command" + build + "" + build_date,"");


    if(Pads.check(new_pad, Pads.UP) && !Pads.check(old_pad, Pads.UP) || old_kbd_char == VK_OLD_UP && kbd_char == VK_NEW_UP) {
menu_option = menu_option - 1;

let new_sound_stream = Sound.load("SWTC/LVL_PS2/Sounds/select.wav");
sound_stream_duration = Sound.duration(new_sound_stream);
Timer.reset(sound_stream_timer);
Sound.play(new_sound_stream);
Sound.resume(music_stream);
let old_sound_stream = sound_stream;
        sound_stream = new_sound_stream;
        Sound.free(old_sound_stream);


    }

    if(Pads.check(new_pad, Pads.DOWN) && !Pads.check(old_pad, Pads.DOWN) || old_kbd_char == VK_OLD_DOWN && kbd_char == VK_NEW_DOWN){
menu_option = menu_option + 1;

Sound.play(select);

    }

    if(Pads.check(new_pad, Pads.CROSS) && !Pads.check(old_pad, Pads.CROSS) || kbd_char == VK_RETURN){
       
	
Sound.play(affirm);

        
        

      }
	  
	  
	  if(Pads.check(new_pad, Pads.CIRCLE) && !Pads.check(old_pad, Pads.CIRCLE)){

Sound.play(back);

        

      }
	  

   }
  
    Screen.flip();

}, 0);

Date.now() wrongly returns the current time in seconds * 1000

I would expect Date.now() to return the current time in milliseconds but it is effectively calculating the value in seconds and then multiplying it by 1000, which means we're actually losing the millisecond precision. The same is happening with performance.now().

  • Expected value: 1650844899292
  • Returned value: 1650844899000

I originally thought the problem was on Duktape falling back to duk_bi_date_get_now_time which only returns time in seconds (and multiplies it by 1000) but using duk_bi_date_get_now_gettimeofday produces the same result because gettimeofday apparently returns 0 on tv_usec.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.