Thank you! I will give that a try and let you know how it works out!
Thanks again!!
-Sandy
Posted 11 October 2020 - 06:25 PM
1) disable hibernation on the PC
(admin command prompt,enter powercfg -hibernate off)
2) See if you can have pup execute this command
powershell.exe -C "$m='[DllImport(\"Powrprof.dll\",SetLastError=true)]static extern bool SetSuspendState(bool hibernate,bool forceCritical,bool disableWakeEvent);public static void PowerSleep(){SetSuspendState(false,false,false); }';add-type -name Import -member $m -namespace Dll; [Dll.Import]::PowerSleep();"
that will send the PC to sleep
If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways
Spend it on Hookers and Blow
Posted 11 October 2020 - 07:31 PM
Sleep rather than power-down isn't one of the built-in options, but that's a good idea for something to add. If you're up for a little Javascript programming, though, I think you could adapt one of the worked examples to do this pretty easily. Take a look in the help at Javascript scripting > Worked Examples > Log Off at Shutdown. The thing you have to change is to take out the part that logs off via User32.ExitWindowsEx(), and instead use a different Windows API that sets sleep mode, SetSuspendState().
Untested, but here's roughly what's needed, replacing the corresponding sections in the example:
// bind the system sleep API [use this to replace the User32 binding in the example] let PowrProf = dllImport.bind("PowrProf.dll", ` BOOL WINAPI SetSuspendState(BOOL bHibernate, BOOL bForce, BOOL bWakeupEventsDisabled); `); // set sleep mode [use this to replace the "log off Windows" section in the example] SetSuspendState(0, 0, 0);[EDIT] On second thought, this isn't quite sufficient; SetSuspendState() is one of those protected APIs that requires you to mess with the process token to enable it. That's doable, but it takes some extra code, and I don't have a ready-made js example to point you to. If you want to try adapting it from C++, you can find the code in PinballY/PlayfieldView.cpp in the github repository - look for the PlayfieldView::PowerOff() routine; you need all the stuff there from the call to OpenThreadToken() to the call to AdjustTokenPrivileges() (inclusive).
I'm looking at the code now. That's a little more involved. I kind of like a challenge. I'll keep you posted!
Thanks!
1) disable hibernation on the PC
(admin command prompt,enter powercfg -hibernate off)
2) See if you can have pup execute this command
powershell.exe -C "$m='[DllImport(\"Powrprof.dll\",SetLastError=true)]static extern bool SetSuspendState(bool hibernate,bool forceCritical,bool disableWakeEvent);public static void PowerSleep(){SetSuspendState(false,false,false); }';add-type -name Import -member $m -namespace Dll; [Dll.Import]::PowerSleep();"that will send the PC to sleep
I've done things like this before and it does work. However when you run it as a script, it runs with your authority. It needs to run with PBY's authority, and as alluded to in the discussion, is a little more involved.
Thanks!
Edited by SandraMe, 11 October 2020 - 07:29 PM.
Posted 11 October 2020 - 09:27 PM
Good morning!
I don’t know if this one is the place to make a suggestion about pinballY...
I would like a new functionality, but I know nothing about programming, so I’ll ask to add it in a new version:
When I setup a system (I’m talking specially about PunballFX3) I have the possibility to add parameters to the setup to make it star in hot seat, single player, no powers, etc. It’s really good, but I would like to choose each time. I think perhaps it would be posible to add the different parameters in the start menu. When you press the button “Start”, in the menu, would be nice to see “play solo” “hot seat 2 players”, “hot seat three players”, etc., but keeping the launch ball button as your usual way to play.
Than you and have a great day!
Enviado desde mi iPad utilizando Tapatalk
Pinball Cabinet: i5-10400, Gforce gtx 1650, 3 displays (32" 720p tv playfield, 19" backglass, 15" dmd), controller: KL25z standalone, no leds, no solenoids (yet), frontend: pinballY, pinball software: visual pinball and pinball fx3.
Website: pinballvirtualparanovatos.com YouTube: https://youtube.com/...9G3H-DSOv-CksJA Twitch: twitch.tv/pinballvirtualparanovatos Telegram: T.me/pinballvirtualparanovatos
Posted 11 October 2020 - 10:50 PM
When you press the button “Start”, in the menu, would be nice to see “play solo” “hot seat 2 players”, “hot seat three players”, etc., but keeping the launch ball button as your usual way to
Take a look at Javascript scripting > Worked Examples > Custom Play Modes in the help. It covers exactly this situation.
Posted 12 October 2020 - 07:00 AM
When you press the button “Start”, in the menu, would be nice to see “play solo” “hot seat 2 players”, “hot seat three players”, etc., but keeping the launch ball button as your usual way to
Take a look at Javascript scripting > Worked Examples > Custom Play Modes in the help. It covers exactly this situation.
Pinball Cabinet: i5-10400, Gforce gtx 1650, 3 displays (32" 720p tv playfield, 19" backglass, 15" dmd), controller: KL25z standalone, no leds, no solenoids (yet), frontend: pinballY, pinball software: visual pinball and pinball fx3.
Website: pinballvirtualparanovatos.com YouTube: https://youtube.com/...9G3H-DSOv-CksJA Twitch: twitch.tv/pinballvirtualparanovatos Telegram: T.me/pinballvirtualparanovatos
Posted 13 October 2020 - 08:38 PM
Ok, I think I've got it. And interestingly enough, the sleep function is available without having to get the process token enabled, at least on my machine.
I've got to say, I've been coding since the days of the coal-fired computers and I've seen a lot of code. And in all my years as a professional, I would rate PinballY as some of the BEST code I have ever seen! AND the documentation is equally as good! Rarely have I seen both documentation and code be so well put together in a system that wasn't written by a team of coders and writers. I would hire you in an instant for any project!
So anyway, enough gushing. Well, maybe later...
![]()
Here is my Main.js:
As I mentioned above, when I tested the suspend function, it did sleep my machine. I did look at the MS documentation and it clearly says that SetSuspendState is protected. I'm not running PinballY in admin mode or anything special, so I'm not sure how I got away with it. If you get different results, please let me know.
Thanks again for pointing me in the right direction, it helped quite a lot! And thank you for PinballY and the wonderful build document. And probably for everything else you've done for virtual pinball, but I haven't actually laid eyes on it yet!
![]()
-Sandy
Posted 14 October 2020 - 02:56 AM
Ok, I think I've got it. And interestingly enough, the sleep function is available without having to get the process token enabled, at least on my machine.
I did look at the MS documentation and it clearly says that SetSuspendState is protected. I'm not running PinballY in admin mode or anything special, so I'm not sure how I got away with it. If you get different results, please let me know.
That's great! It makes it a lot simpler that you don't need to mess with the privilege bit. I didn't actually test that - I just took the SDK page at face value. Maybe that's just wrong, or there's some nuance about which Windows versions it applies to, or something like that.
I put the command.allocate in main because I wasn't sure of the best place to do the allocation. If there is a better place for it let me know. I wanted to make sure the allocation only happened once and not every time a menu was opened.
That's exactly the right idea. I'd probably put it in one or the other of your imported .js files myself (outside of any functions, just like you have it), just for the sake of grouping it with the code that uses it, but functionally it's the same either way.
Posted 16 October 2020 - 04:53 PM
Hello!
I have a question about "Batch Capture". I would like to add all my games to batch capture so that I can stop the capture mid-way through the list, and then come back later and continue where I left off. I believe this is how it would work. However, I can't find a way to automatically add all tables to my batch list. Is this possible?
Thank you!
Posted 16 October 2020 - 06:43 PM
I have a question about "Batch Capture". I would like to add all my games to batch capture so that I can stop the capture mid-way through the list, and then come back later and continue where I left off. I believe this is how it would work. However, I can't find a way to automatically add all tables to my batch list. Is this possible?
There are two features here that might be relevant, so let me make sure we're talking about the same thing. The first is the "Mark for Batch Capture" command (in the game setup menu). Is that the one you have in mind? What I'm getting from your question is that you'd like to do the same thing, but apply it to all games at once - maybe a command (that doesn't exist) called "Mark All Games For Batch Capture". Am I on the right track here?
The second feature is the Batch Capture command itself, which actually initiates the capture process on a batch. That's in the operator menu (press the digit "0" button to bring that up). If you step through the menus for that command, I think you might find what you're looking for. The first step in that command lets you select which games you want to include, and one of the options is "All Games". Another option is "Games Marked for Batch Capture", which goes back to the "Mark" command of the first feature above. If you just want to capture all games, there's no need to "Mark" any of them - just select "All" in the first step of the batch capture process..
Does that address what you're trying to do, or am I missing your point?
Posted 16 October 2020 - 06:57 PM
What I'm getting from your question is that you'd like to do the same thing, but apply it to all games at once - maybe a command (that doesn't exist) called "Mark All Games For Batch Capture". Am I on the right track here?
Hi, mjr. Yes that is correct. I'd like to "Mark All Games for Batch Capture" so that when I initiate the batch capture using "Games Marked for Batch Capture" then all the games get checked off that list. The benefit over simply selecting "All Games" is that one could stop the batch and then later come pick up where it was interrupted.
I took a peak in the database XML hoping that the batch capture parameter was available there, but it doesn't seem to be. Is there another work around?
Thank you!
Edited by apophis, 16 October 2020 - 06:58 PM.
Posted 16 October 2020 - 08:42 PM
I'd like to "Mark All Games for Batch Capture" so that when I initiate the batch capture using "Games Marked for Batch Capture" then all the games get checked off that list. The benefit over simply selecting "All Games" is that one could stop the batch and then later come pick up where it was interrupted.
Oh, I get it - it's more the un-marking as the capture proceeds that you're really after. Well, one easy way would be to use the "missing media only" options when setting up the capture, but that might not fit your use case (e.g., if you intend to do a fresh rebuild of all of the media). The "marked for batch capture" status is in the GameStats.csv file if you wanted to do it manually, but that's certainly not ideal. The better way would be through Javascript, since you can access and manipulate a game's "marked" flag (along with most other properties) there. Not tested, but here's how roughly (modulo any typos) how you'd create your own "Mark All Games" command:
let markAllCommand = command.allocate("MarkAllGamesForBatchCapture");
mainWindow.on("menuopen", ev => {
if (ev.id == "game setup") {
ev.addMenuItem(
{ after: command.MarkForBatchCapture },
{ title: "Mark All Games for Capture", cmd: markAllCommand });
}
});
mainWindow.on("command", ev => {
if (ev.id == markAllCommand) {
gameList.getAllGames().forEach(game => game.update({ isMarkedForCapture: true }));
}
});
Posted 19 October 2020 - 06:59 PM
When you press the button “Start”, in the menu, would be nice to see “play solo” “hot seat 2 players”, “hot seat three players”, etc., but keeping the launch ball button as your usual way to
Take a look at Javascript scripting > Worked Examples > Custom Play Modes in the help. It covers exactly this situation.
Hey Mjr!
Finally i could try it... without success. I now nothing about programming, so it was really difficult for me to understand all the things you explain there (and i have a second handicap: i'm not really good at english language). So i'll expose the problem, i hope you could help me.
I create the js file triying to make a secundary menu. Ok, some tries, but it's working. Yey! Onlly one thing here: I think there is an error in the code at the webpage, a ")" missing after "command.Playgame". Fotunately, the pinbally log gived me the clue:
"mainWindow.on("command", ev => {
if (ev.id == command.PlayGame {
// it's the Play command "
Now i have a second problem, and i don't see how to solve it: It always enter un "normal" mode, no matter what option i press... So the menu exist, but does nothing. :_(
Here is the code:
And here is the pinballY log:
I think the problem is that PinballY send the parameter before the launch command, not after. So where it says in the log:
+ Original> -hotseat_2 -applaunch 442120 "-table_[TABLEFILEBASE]"
Am I right? How can i solve it?
Thank you and have a great week!
Pinball Cabinet: i5-10400, Gforce gtx 1650, 3 displays (32" 720p tv playfield, 19" backglass, 15" dmd), controller: KL25z standalone, no leds, no solenoids (yet), frontend: pinballY, pinball software: visual pinball and pinball fx3.
Website: pinballvirtualparanovatos.com YouTube: https://youtube.com/...9G3H-DSOv-CksJA Twitch: twitch.tv/pinballvirtualparanovatos Telegram: T.me/pinballvirtualparanovatos
Posted 19 October 2020 - 07:20 PM
+ Original> -hotseat_2 -applaunch 442120 "-table_[TABLEFILEBASE]"
+ Final > -hotseat_2 -applaunch 442120 "-table_Atlantis"It should say:+ Original> -applaunch 442120 "-table_[TABLEFILEBASE]" -hotseat_2+ Final > -applaunch 442120 "-table_Atlantis" -hotseat_2
I'm not sure how FX3 parses the options, but I could easily believe that you're right about the order needing to change. In that case, all you'd need to do is change the way you construct the override parameters, like so:
overrides: { params: sys.params + extras }
That would put the added "hotseat" flags at the end of the option list rather than at the beginning. If it turns out that the order dependency is even worse and you have to insert the "hotseat" flags in the middle somewhere, you could do that with a Javascript regular expression "replace" operation (I can help you out with that if that's what needed).
One little added note: if you move the "+ extras" to the end like that, you should also change the text in the "extras" assignments so that the added space is at the beginning of the string rather than at the end, so that it adds a space at the right place when combining the strings.
E.g., change extras = "-hotseat_4 " to extras = " -hotseat_4".
Posted 20 October 2020 - 03:58 PM
I'm not sure how FX3 parses the options, but I could easily believe that you're right about the order needing to change. In that case, all you'd need to do is change the way you construct the override parameters, like so:
overrides: { params: sys.params + extras }
That would put the added "hotseat" flags at the end of the option list rather than at the beginning.
[...]
E.g., change extras = "-hotseat_4 " to extras = " -hotseat_4".
It works! Thank you so much!
I share the script here just in case anyones need it, and of course you can share it in your webpage (it's your code, bur everything together, haha).
If anyone need it: you only have to put it inside the scripts folder in pinballY, and insert inside the main.js script this line:
import "playmodefx3.js";
Thank you again mjr! You and JPSalas, mainly, are my pinball heroes! hahaha.
Pinball Cabinet: i5-10400, Gforce gtx 1650, 3 displays (32" 720p tv playfield, 19" backglass, 15" dmd), controller: KL25z standalone, no leds, no solenoids (yet), frontend: pinballY, pinball software: visual pinball and pinball fx3.
Website: pinballvirtualparanovatos.com YouTube: https://youtube.com/...9G3H-DSOv-CksJA Twitch: twitch.tv/pinballvirtualparanovatos Telegram: T.me/pinballvirtualparanovatos
Posted 02 December 2020 - 10:35 PM
Hi,
I'm having an issue getting DOF to run with PinballY.
DOF is working when a table loads, but not in the front-end.
I have read and tried all solutions I found for similar issues.
Any assistance is appreciated!
PinballY Log:
Wednesday, December 02, 2020, 3:21:35 PM: Session started PinballY 1.0.0 (Release), build 9375 (x64, 20200723-1914) DOF (DirectOutput): initializing DOF client + Launching DOF surrogate process. This is required because PinballY is running in 64-bit, and DOF is a 32-bit COM object. Surrogate command line: >"G:\PinballY\Dof3264Surrogate.exe" -parent_pid=5116 -clsid=fd6707e5-03a1-4951-bf90-49b2ef556b36 DOF surrogate launch failed: Command line: "G:\PinballY\Dof3264Surrogate.exe" -parent_pid=5116 -clsid=fd6707e5-03a1-4951-bf90-49b2ef556b36 CreateProcess Error: The requested operation requires elevation. DOF: creating DOF COM object (a23bfdbc-9a8a-46c0-8672-60f23d54ffb6) DOF: DOF COM object (a23bfdbc-9a8a-46c0-8672-60f23d54ffb6) is not registered on this system; DOF will not be used for this session DOF (DirectOutput): initializing DOF client DOF: creating DOF COM object (a23bfdbc-9a8a-46c0-8672-60f23d54ffb6) DOF: DOF COM object (a23bfdbc-9a8a-46c0-8672-60f23d54ffb6) is not registered on this system; DOF will not be used for this session
Here are the relevant registry entries:
Edited by tsolyankee, 02 December 2020 - 10:37 PM.