Gotos / CuteCapture

A 3DS capture software for linux and mac
Apache License 2.0
44 stars 6 forks source link

Simplify zoom logic, add 256x384 crop option for DS games, fix FPS bug #5

Closed sudofox closed 4 years ago

sudofox commented 4 years ago

Now you can press C to crop the window to 256x384 (works with split mode) when you've launched a game in "original resolution" mode.

https://en-americas-support.nintendo.com/app/answers/detail/a_id/179/~/how-to-play-nintendo-ds-and-dsi-games-in-their-original-resolution

sudofox commented 4 years ago

Hold on, I made a mistake with the zoom levels.

sudofox commented 4 years ago

Still working on it, might take a bit to finish.

// Zoom notes

// pressing the 0 key should be treated as zoomLevel 10
// Math for screen height in split/nonsplit can be combined
// width ratio calculated by (halfNativeWidth * zoomLevel) + halfNativeWidth

// For combined, non-cropped mode...

screenWidth = (200 * zoomLevel) + 200
screenHeight = (3 * screenWidth / 5) * 2

// For top screen, non-cropped mode

screenWidth = (200 * zoomLevel) + 200
screenHeight = (3 * screenWidth / 5)

// For the bottom screen, non-cropped mode

screenWidth  = (160 * zoomLevel) + 160
screenHeight = (3 * screenWidth / 4)

// For combined, cropped mode

screenWidth  = (128 * zoomLevel) + 128
screenHeight = (3 * screenWidth / 4) * 2

// For split, cropped mode

screenWidth  = (128 * zoomLevel) + 128
screenHeight = (3 * screenWidth / 4)
sudofox commented 4 years ago

That should make things nice and spiffy. Wish I would stop accidentally committing to GitHub without the commits being tied to my account properly, lol.

Also, sorry if the math in the setSize calls is overcomplicated, this is maybe my first or second time writing C++ code and I was a bit confused about how to properly create temporary variables.

sudofox commented 4 years ago

That's a one-line fix for a problem where FPS would go up to 4000 FPS when the 3DS was closed or disconnected. I'd close my 3DS and come back to a laptop blasting its fans as fast as it could muster.

Gotos commented 4 years ago

Thanks! I haven't been home in a while, but will be by the end of the week. I'll hope I can test this at the weekend and merge it, if I don't find problems :) [Edit:] Looking at the code, it definitely looks a lot cleaner than my old code tho, much appreciated :D

sudofox commented 4 years ago

How're we looking?

Gotos commented 4 years ago

Just got around to test this, looks good. Thanks! :)