Welcome, Guest!

Here are some links you may find helpful

N64 Need some help with the N64 OS standard functions

Impendo64

Member
Registered
Joined
Jul 23, 2019
Messages
24
Reaction score
5
Points
3
Hi everyone !

Does anyone could help me with the N64 Os standard library and most precisely on the controller functions ?

I'm trying to develop some tools related to the SI devices but I have some troubles with a special case.

I have a device that, when plugged in has a certain hex value (different of 0) which isn't defined in the cont.h file. At that point it isn't a problem (I've added it to the file) but an odd thing appears after the osContGetQuery() call. It returns me an 0x0008 which is a CONT_NO_RESPONSE_ERROR . That means that there is no response from the controller and that the controller is not inserted.

I normally have this value called back when the status is 0 but never when a status value is present.

Does anyone knows how I could fix that ?

I can give some screenshots from a N64 capture if needed.

Thanks
 

fraser.MIPS

New member
Joined
Jul 9, 2020
Messages
2
Reaction score
2
Points
3
I hope you have managed to figure this out for yourself, but just in case and for anyone else that finds this question.
It sounds like you are using a custom device plugged into a Controller Port on the Console.

Assuming that your device is responding with a correct JoyBus waveform, and the issue is only with the code.

Only the Controllers are queried by the osContGetQuery() api call. Controller devices must respond to the following SI/JoyBus Commands
It sounds like your custom device is identifying with a "non-controller" value when responding to osContGetQuery. Unfortunately I think the 0x0008 response is calculated inside that function and there isn't any source code available or other way to modify this value. This is fine, there are other devices that would fail like your device for example the VRU and the Keyboard.
If you are writing homebrew application for this device you can actually skip the osContGetQuery or ignore the error and continue.
If your device responds to the osContStartReadData with data the size of Controller data (4 bytes), you can get those values ( u16 button; s8 stick_x; s8 stick_y; ) and compare to whatever values are appropriate for your device.

If you need a custom API for your device, I would suggest reviewing some of the available decompilation repositories to see what the normal code looks like and use that as a template.
 

Impendo64

Member
Registered
Joined
Jul 23, 2019
Messages
24
Reaction score
5
Points
3
I hope you have managed to figure this out for yourself, but just in case and for anyone else that finds this question.
It sounds like you are using a custom device plugged into a Controller Port on the Console.

Assuming that your device is responding with a correct JoyBus waveform, and the issue is only with the code.

Only the Controllers are queried by the osContGetQuery() api call. Controller devices must respond to the following SI/JoyBus Commands
It sounds like your custom device is identifying with a "non-controller" value when responding to osContGetQuery. Unfortunately I think the 0x0008 response is calculated inside that function and there isn't any source code available or other way to modify this value. This is fine, there are other devices that would fail like your device for example the VRU and the Keyboard.
If you are writing homebrew application for this device you can actually skip the osContGetQuery or ignore the error and continue.
If your device responds to the osContStartReadData with data the size of Controller data (4 bytes), you can get those values ( u16 button; s8 stick_x; s8 stick_y; ) and compare to whatever values are appropriate for your device.

If you need a custom API for your device, I would suggest reviewing some of the available decompilation repositories to see what the normal code looks like and use that as a template.


Thanks a lot for your informations fraser.MIPS !

Yes by the time, I've managed to understand that it wasn't a problem of the device but with the code. As you said, the device is detected with the value 0x0202 which isn't defined in the os_cont.h controller type and without having access to the osContGetQuery function code, I couldn't handle an exception for my device...

I would love to check out some decompilated repositories to use it as a template to put on a API :) . IDK if it's legal to put here some URL so you can send them to me on PM :)

Thanks again !
 
shape1
shape2
shape3
shape4
shape5
shape6
Top