Homebrew mGBA and blargSNES compile request

WiiUBricker

News Police
OP
Banned
Joined
Sep 19, 2009
Messages
7,827
Trophies
0
Location
Espresso
XP
7,510
Country
Argentina
After gfxInit or gfxInitDefault.
Thanks. There is only a gfxInit(GSP_BGR8_OES, GSP_BGR8_OES, false); in the main.c. I added
gfxInitDefault();
gfxSet3D(true);

after it and it enabled 3D mode. But something is off about the picture. While the pixels are now square, the 3D effect is a bit too intense.
 

hippy dave

BBMB
Member
Joined
Apr 30, 2012
Messages
9,889
Trophies
2
XP
29,398
Country
United Kingdom
Thanks. There is only a gfxInit(GSP_BGR8_OES, GSP_BGR8_OES, false); in the main.c. I added
gfxInitDefault();
gfxSet3D(true);

after it and it enabled 3D mode. But something is off about the picture. While the pixels are now square, the 3D effect is a bit too intense.
Get rid of that, it's not needed if gfxInit is already there.

e: what you're describing is probably because it's only drawing to one side/eye of the 3d display.
 
Last edited by hippy dave,

DiscostewSM

Well-Known Member
Member
Joined
Feb 10, 2009
Messages
5,484
Trophies
2
Location
Sacramento, California
Website
lazerlight.x10.mx
XP
5,496
Country
United States
Okay, I tried to compile mGBA and blargSNES, and I swear these are the two most uncompilable 3ds projects ever. I'm not a expert on compiling projects, but considering the cmakelists they provided doesn't work without modification, I gave up on mGBA (providing raw2c the makefile will not process the .raw file that it needs still, and the makefiles that cmake generates are not very easy to follow).

Compiling blargSNES requires nihstro which for the life of me I cannot compile either, because it was not meant to be used on newer boost library versions. All of the precompiled versions of nihstro I could find were for windows, and my devkitpro environment was linux, so it was a no-go.

Good luck to you man though, personally I just stick to retroarch.

The "veryhard" branch for blargSNES has defaulted to using picasso, which comes with the newest devkitpro. If you're updated on that and ctrulib, then it should compile.
 

DiscostewSM

Well-Known Member
Member
Joined
Feb 10, 2009
Messages
5,484
Trophies
2
Location
Sacramento, California
Website
lazerlight.x10.mx
XP
5,496
Country
United States
Any idea how to fix this?

If you just want to enable 3D, but have the display remain as 2D, then all you need to do is look into the code and find instances of where it does a GX_DisplayTransfer, but make sure that the destination (3rd parameter) is pointing to a function listed as "(u32*)gfxGetFramebuffer". Duplicate the line of code to follow immediately after the first one in each instance, but make a change from where you see "GFX_LEFT" following "GFX_TOP" in the duplicate, and change the LEFT to a RIGHT. That way, it copies the same buffer to both sides/eyes.

In blargSNES, there are only two calls that do that (that aren't commented).

edit:

Oh, in case the project is using citro3d, instead of looking for GX_DisplayTransfer, look for C3D_RenderBufTransfer. Make the same necessary changes as described above.
 
Last edited by DiscostewSM,
  • Like
Reactions: WiiUBricker

WiiUBricker

News Police
OP
Banned
Joined
Sep 19, 2009
Messages
7,827
Trophies
0
Location
Espresso
XP
7,510
Country
Argentina
Just a heads ups guys, if you want to check out the difference between the image quality of square pixels versus "scanlined pixels", download GameYob. It has proper 3D mode enabled by default via the citrus library. Slide the 3D slider all to the bottom to enable the scanline picture and slide it to the top to see square pixels. It's baffling to me why other emulator developers force those damn scanlines on us instead of giving us the choice of the image quality.
 

DarkMatterCore

Finding my light.
Developer
Joined
May 30, 2009
Messages
1,292
Trophies
1
Age
28
Location
Madrid, Spain
Website
github.com
XP
2,606
Country
Spain
I have already applied the changes suggested by DiscostewSM to the "veryhard" branch of blargSnes. So far, it seems the changes didn't break anything. Here's it in case you wanna try it out yourself.

I'll give mGBA a try.
 

Attachments

  • blargSnes-veryhard_3d-mod.rar
    152.2 KB · Views: 120
Last edited by DarkMatterCore,
  • Like
Reactions: zfreeman

WiiUBricker

News Police
OP
Banned
Joined
Sep 19, 2009
Messages
7,827
Trophies
0
Location
Espresso
XP
7,510
Country
Argentina
I have already applied the changes suggested by DiscostewSM to the "veryhard" branch of blargSnes. So far, it seems the changes didn't break anything. Here's it in case you wanna try it out yourself.

I'll give mGBA a try.
Thank you very much :) I will test this later as I'm going to get some sleep. Just one question though. What's the difference between the veryhard and the master branch?
 

DarkMatterCore

Finding my light.
Developer
Joined
May 30, 2009
Messages
1,292
Trophies
1
Age
28
Location
Madrid, Spain
Website
github.com
XP
2,606
Country
Spain
Thank you very much :) I will test this later as I'm going to get some sleep. Just one question though. What's the difference between the veryhard and the master branch?

There are quite a few changes, as already explained by DiscostewSM; but most importantly, it uses picasso instead of nihstro to compile the shaders. It's also updated to support the latest ctrulib. I don't know if it's me, but I can also notice a minor speed-up in some games (like Chrono Trigger).

I didn't have a single problem compiling it, unlike mGBA, which is giving me quite a hard time right now. :D
 

WiiUBricker

News Police
OP
Banned
Joined
Sep 19, 2009
Messages
7,827
Trophies
0
Location
Espresso
XP
7,510
Country
Argentina
I have already applied the changes suggested by DiscostewSM to the "veryhard" branch of blargSnes. So far, it seems the changes didn't break anything. Here's it in case you wanna try it out yourself.
It works and it looks gorgeous!. Thank you very much. Do you mind sharing your modified source code for this?

@DiscostewSM I duplicated this line of code:

Code:
GX_DisplayTransfer(gpuOut, 0x019000F0, (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), 0x019000F0, 0x00001000);

and changed GFX_LEFT to GFX_RIGHT:

Code:
GX_DisplayTransfer(gpuOut, 0x019000F0, (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), 0x019000F0, 0x00001000);
GX_DisplayTransfer(gpuOut, 0x019000F0, (u32*)gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL), 0x019000F0, 0x00001000);

On two instances in the main.c. It did compile, but 3D didn't work. What did I do wrong?

Edit: Nevermind, I forgot to set gfxSet3D to true. It's working now :grog:
 
Last edited by WiiUBricker,

WiiUBricker

News Police
OP
Banned
Joined
Sep 19, 2009
Messages
7,827
Trophies
0
Location
Espresso
XP
7,510
Country
Argentina
I have issues enabling 3D in mgba. I believe this is the section of the code that needs to be changed (main.c):

Code:
static void _drawEnd(void) {
    int screen = screenMode < SM_PA_TOP ? GFX_BOTTOM : GFX_TOP;
    u16 width = 0, height = 0;

    void* outputFramebuffer = gfxGetFramebuffer(screen, GFX_LEFT, &height, &width);
    ctrGpuEndFrame(screen, outputFramebuffer, width, height);

    if (screen != GFX_BOTTOM) {
        if (guiDrawn & (GUI_THIS_FRAME | GUI_ACTIVE)) {
            void* outputFramebuffer = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, &height, &width);
            ctrGpuEndFrame(GFX_BOTTOM, outputFramebuffer, width, height);
        } else if (screenCleanup & SCREEN_CLEANUP_BOTTOM) {
            ctrGpuBeginFrame(GFX_BOTTOM);
            if (screenCleanup & SCREEN_CLEANUP_BOTTOM_1) {
                screenCleanup &= ~SCREEN_CLEANUP_BOTTOM_1;
            } else if (screenCleanup & SCREEN_CLEANUP_BOTTOM_2) {
                screenCleanup &= ~SCREEN_CLEANUP_BOTTOM_2;
            }
            void* outputFramebuffer = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, &height, &width);
            ctrGpuEndFrame(GFX_BOTTOM, outputFramebuffer, width, height);
        }
    }

    if ((screenCleanup & SCREEN_CLEANUP_TOP) && screen != GFX_TOP) {
        ctrGpuBeginFrame(GFX_TOP);
        if (screenCleanup & SCREEN_CLEANUP_TOP_1) {
            screenCleanup &= ~SCREEN_CLEANUP_TOP_1;
        } else if (screenCleanup & SCREEN_CLEANUP_TOP_2) {
            screenCleanup &= ~SCREEN_CLEANUP_TOP_2;
        }
        void* outputFramebuffer = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, &height, &width);
        ctrGpuEndFrame(GFX_TOP, outputFramebuffer, width, height);
    }

    ctrGpuEndDrawing();
}

I tried duplicating the lines saying GFX_LEFT and changing GFX_LEFT to GFX_RIGHT, but it didn't compile. Any ideas?
 

norips

Active Member
Newcomer
Joined
Aug 13, 2012
Messages
32
Trophies
0
XP
162
Country
France
I have issues enabling 3D in mgba. I believe this is the section of the code that needs to be changed (main.c):

Code:
static void _drawEnd(void) {
    int screen = screenMode < SM_PA_TOP ? GFX_BOTTOM : GFX_TOP;
    u16 width = 0, height = 0;

    void* outputFramebuffer = gfxGetFramebuffer(screen, GFX_LEFT, &height, &width);
    ctrGpuEndFrame(screen, outputFramebuffer, width, height);

    if (screen != GFX_BOTTOM) {
        if (guiDrawn & (GUI_THIS_FRAME | GUI_ACTIVE)) {
            void* outputFramebuffer = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, &height, &width);
            ctrGpuEndFrame(GFX_BOTTOM, outputFramebuffer, width, height);
        } else if (screenCleanup & SCREEN_CLEANUP_BOTTOM) {
            ctrGpuBeginFrame(GFX_BOTTOM);
            if (screenCleanup & SCREEN_CLEANUP_BOTTOM_1) {
                screenCleanup &= ~SCREEN_CLEANUP_BOTTOM_1;
            } else if (screenCleanup & SCREEN_CLEANUP_BOTTOM_2) {
                screenCleanup &= ~SCREEN_CLEANUP_BOTTOM_2;
            }
            void* outputFramebuffer = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, &height, &width);
            ctrGpuEndFrame(GFX_BOTTOM, outputFramebuffer, width, height);
        }
    }

    if ((screenCleanup & SCREEN_CLEANUP_TOP) && screen != GFX_TOP) {
        ctrGpuBeginFrame(GFX_TOP);
        if (screenCleanup & SCREEN_CLEANUP_TOP_1) {
            screenCleanup &= ~SCREEN_CLEANUP_TOP_1;
        } else if (screenCleanup & SCREEN_CLEANUP_TOP_2) {
            screenCleanup &= ~SCREEN_CLEANUP_TOP_2;
        }
        void* outputFramebuffer = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, &height, &width);
        ctrGpuEndFrame(GFX_TOP, outputFramebuffer, width, height);
    }

    ctrGpuEndDrawing();
}

I tried duplicating the lines saying GFX_LEFT and changing GFX_LEFT to GFX_RIGHT, but it didn't compile. Any ideas?
Actually you can't set GFX_RIGHT for GFX_BOTTOM because GFX_BOTTOM only have 1 screen try modifying this line
Code:
void* outputFramebuffer = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, &height, &width);
with this
Code:
void* outputFramebuffer = gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, &height, &width);
if you want to use the right screen.
But this will not create 3D by magic ! For enabling real 3D you need to offset the frame position postively or negatively depends on what you want (aka depth)
 
Last edited by norips,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • K3Nv2 @ K3Nv2:
    It's low on wood
    +1
  • Xdqwerty @ Xdqwerty:
    lemme ask in forums
  • Xdqwerty @ Xdqwerty:
    yawn
  • BigOnYa @ BigOnYa:
    @Xdqwerty No you heard wrong, and don't believe till you experience yourself. Fallout 4 is one of my favorite games of all time. Yes it had issues early on, esp with older hardware like the xbox1, but it is awesome, esp now being 4k on Series S/X or PS5
    +2
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, Then i think people were talking about fallout 76
  • Xdqwerty @ Xdqwerty:
    that one was buggy too
  • BigOnYa @ BigOnYa:
    Yea you right there, fallout 76 was a letdown, but it not that bad now, they have fixed slot of issues they had at launch. Biggest issue with Fallout 76 is its a pay to advance further type of game, which sucks
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, I may probably download fallout 3 or new vegas on my ps3
  • Xdqwerty @ Xdqwerty:
    cuz I didnt like fallout 1 that much
  • BigOnYa @ BigOnYa:
    New Vegas is awesome, F3 was ok too.
  • Psionic Roshambo @ Psionic Roshambo:
    I played Fallout 4 on PC, I enjoyed it honestly. Not my favorite game on earth but at the same time I didn't hate it at all lol
  • BigOnYa @ BigOnYa:
    That's cool you got a ps3... Glad to hear. Game on!
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Ironic this was posted today lol
  • BigOnYa @ BigOnYa:
    I think the tv series has boasted play of, I did see they said playing of it Is up, way more than norm
    +1
  • BigOnYa @ BigOnYa:
    I've been playing the next gen version on Series X all day, I love it. :wub:
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Downloading some random stuff, damn almost 400GBs in like 4 hours lol
  • Psionic Roshambo @ Psionic Roshambo:
    Gonna be over 1TB this month.... damn lol
  • Xdqwerty @ Xdqwerty:
    good night
    +1
  • BigOnYa @ BigOnYa:
    At least you have some fast speeds. What a drag that used to be, I remb downloading 1 pic back in the day, and seeing line by line show
    +1
  • BigOnYa @ BigOnYa:
    Nighty night.
  • BigOnYa @ BigOnYa:
    Or worse, you downloading something, and someone calls your phone and interupts the download, good ole AOL. Of course that's before most you guys even were born yet.
  • Psionic Roshambo @ Psionic Roshambo:
    Lol I think my first modem was 48K but it had some sort of firmware or software update that let me get 56K
  • Psionic Roshambo @ Psionic Roshambo:
    I had EarthLink lol
    Psionic Roshambo @ Psionic Roshambo: I had EarthLink lol