yifanlu / taiHEN

CFW framework for PS Vita
MIT License
302 stars 46 forks source link

Better Threading/API for Plugins #38

Closed Kyle873 closed 7 years ago

Kyle873 commented 7 years ago

As advised by @DaveeFTW. Conversation excerpt follow.

<Kyle873> I don't suppose there's a way for me to directly manipulate the input buffer instead of just reading from it?
<Kyle873> rather, I just want to clear it
<davee[m]> Kyle873: context?
<Kyle873> davee[m], developing a game plugin, using the main thread priority hack I've seen others do to pause the main thread while I keep a menu up, on resume of the main thread, some input bleeds into the game thread
<davee[m]> threads are a bad idea
<Kyle873> don't really see another way to do it
<Kyle873> unless i want all my menu control to also flow into the game, which I don't
<Kyle873> davee[m], a very condensed view of the flow http://tinyurl.com/j3vz4a6
<davee[m]> we seriously need a better way to handle threads for plugins
<davee[m]> can you do me a favour and create an issue on taihen github requesting that?
<davee[m]> Kyle873: yeah, threading really sucks on the vita
<davee[m]> there needs to be some API to assist plugins I think
yifanlu commented 7 years ago

Can you be more specific? Like what sort of API? "Pause main thread"?

Kyle873 commented 7 years ago

I don't know what @DaveeFTW had in mind particularly, but that is one thing that would be handy, yes. The way it's done now by plugins obviously has some repercussions, and it's also a giant hack.

I don't really have many other suggestions personally, as I've been able to do everything I needed to so far with the APIs I've been provided. The only reason I brought up clearing the input buffer myself was a stopgap to fixing the input bleeding issue I was having.

The only other thing I would maybe suggest is some basic framebuffer drawing functions. However, I'm not sure if you feel that kind of stuff should be implemented on a need-to-use basis by plugins or provided by a standardized API. Stuff like basic primitive drawing, font/image rendering, etc.

yifanlu commented 7 years ago

Have you looked at sceCtrlSetButtonIntercept? Add this

extern int sceCtrlSetButtonIntercept(int intercept);

and call it with sceCtrlSetButtonIntercept(1).

Kyle873 commented 7 years ago

Thank you, that's exactly what I needed! Any reason that's not in the ctrl.h header? Better yet, is there somewhere I should be looking for documentation besides just the headers?

yifanlu commented 7 years ago

After farther deliberation, I don't think I want to introduce any new APIs to taiHEN.