Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move sceGeEdramSetSize function to sceGe_driver #223

Closed
wants to merge 1 commit into from

Conversation

diamant3
Copy link
Member

@sharkwouter sharkwouter self-assigned this Jul 29, 2024
@sharkwouter
Copy link
Member

I am not able to test this, since I this seems to move the function to a place that requires kernel mode and I don't know how to trigger that.

I have the following code from the issue which compiles:

CMakeLists.txt

cmake_minimum_required(VERSION 3.0)

project(edramsize)

add_executable(${PROJECT_NAME}
  main.c
)

target_link_libraries(${PROJECT_NAME}
  pspdebug
  pspdisplay
  pspge
  pspge_driver
)

create_pbp_file(
    TARGET ${PROJECT_NAME}
    ICON_PATH NULL
    BACKGROUND_PATH NULL
    PREVIEW_PATH NULL
    TITLE ${PROJECT_NAME}
)

main.c:

#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspge.h>

PSP_MODULE_INFO("PSP VRAM ISSUE", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);

int main(int argc, char *argv[])
{
    pspDebugScreenInit(); // Initialize the debug screen

    struct KernelCallArg args = {0x400000};
    if (sceGeEdramSetSize(0x400000) == 0)
    {
        pspDebugScreenPrintf("sceGeEdramSetSize 4MB ok\n"); // Never called
    }
    else
    {
        pspDebugScreenPrintf("sceGeEdramSetSize 4MB ERROR\n"); // Called
    }

    pspDebugScreenPrintf("%i", sceGeEdramGetSize()); // Prints "2097152" instead of the double

    while (1)
    {
        sceDisplayWaitVblankStart();
    }
}

I get a 0x8002013C error when trying to start it.

One thing of note, with this change you need to link to pspge_driver.

@joel16
Copy link
Contributor

joel16 commented Jul 29, 2024

I am not able to test this, since I this seems to move the function to a place that requires kernel mode and I don't know how to trigger that.

I have the following code from the issue which compiles:

CMakeLists.txt

cmake_minimum_required(VERSION 3.0)

project(edramsize)

add_executable(${PROJECT_NAME}
  main.c
)

target_link_libraries(${PROJECT_NAME}
  pspdebug
  pspdisplay
  pspge
  pspge_driver
)

create_pbp_file(
    TARGET ${PROJECT_NAME}
    ICON_PATH NULL
    BACKGROUND_PATH NULL
    PREVIEW_PATH NULL
    TITLE ${PROJECT_NAME}
)

main.c:

#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspge.h>

PSP_MODULE_INFO("PSP VRAM ISSUE", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);

int main(int argc, char *argv[])
{
    pspDebugScreenInit(); // Initialize the debug screen

    struct KernelCallArg args = {0x400000};
    if (sceGeEdramSetSize(0x400000) == 0)
    {
        pspDebugScreenPrintf("sceGeEdramSetSize 4MB ok\n"); // Never called
    }
    else
    {
        pspDebugScreenPrintf("sceGeEdramSetSize 4MB ERROR\n"); // Called
    }

    pspDebugScreenPrintf("%i", sceGeEdramGetSize()); // Prints "2097152" instead of the double

    while (1)
    {
        sceDisplayWaitVblankStart();
    }
}

I get a 0x8002013C error when trying to start it.

One thing of note, with this change you need to link to pspge_driver.

This PR is moving sceGeEdramSetSize to a kernel library. You're attempting to use it in a usermode application, which won't work. You'll need to use kubridge or write your own kernel -> user plugin to use this. Also, don't you have to initialize this with sceGeEdramInit before attempting to call sceGeEdramSetSize?

@diamant3
Copy link
Member Author

I get a 0x8002013C error when trying to start it.

One thing of note, with this change you need to link to pspge_driver.

Thanks for testing! too bad we're same result.

I'm trying to learn how to work on this one here: https://uofw.github.io/upspd/docs/software/ModuleTutorialv1.pdf but not sure if this is the correct one to get this thing work. also practicing some samples from https://github.com/pspdev/pspsdk/tree/master/src/samples/prx. Right now, I'm really confused how this thing works and I don't want to go down to the rabbit hole for this(hopefully not😅). Should I draft this, close it or just open?

You'll need to use kubridge or write your own kernel -> user plugin to use this. Also, don't you have to initialize this with sceGeEdramInit before attempting to call sceGeEdramSetSize?

I applied this one too, I tried the kubridge and calling the sceGeEdramInit first, both PPSSPP(like 0x8002013C or 0x8002013A errors I always got and sometimes it's just a violet screen with the same error :( ) and PSP(just exiting with a 0x8002013C error) but it's not working to me, also something like sceKernelLoadModule functions I tried but no luck. last but not the least, I tried to use the setK1 or something to trick my eboot.pbp to call the kernel functions but it's not working to me too.

@joel16
Copy link
Contributor

joel16 commented Jul 30, 2024

I get a 0x8002013C error when trying to start it.
One thing of note, with this change you need to link to pspge_driver.

Thanks for testing! too bad we're same result.

I'm trying to learn how to work on this one here: https://uofw.github.io/upspd/docs/software/ModuleTutorialv1.pdf but not sure if this is the correct one to get this thing work. also practicing some samples from https://github.com/pspdev/pspsdk/tree/master/src/samples/prx. Right now, I'm really confused how this thing works and I don't want to go down to the rabbit hole for this(hopefully not😅). Should I draft this, close it or just open?

You'll need to use kubridge or write your own kernel -> user plugin to use this. Also, don't you have to initialize this with sceGeEdramInit before attempting to call sceGeEdramSetSize?

I applied this one too, I tried the kubridge and calling the sceGeEdramInit first, both PPSSPP(like 0x8002013C or 0x8002013A errors I always got and sometimes it's just a violet screen with the same error :( ) and PSP(just exiting with a 0x8002013C error) but it's not working to me, also something like sceKernelLoadModule functions I tried but no luck. last but not the least, I tried to use the setK1 or something to trick my eboot.pbp to call the kernel functions but it's not working to me too.

I wouldn't use PPSSPP for testing kernel->user functionality. However, I know you should be able to use kuKernelCall like this: https://github.com/joel16/CMFileManager-PSP/blob/30b0be604e4ea9cf770bd4c56e7db1af8355fbbb/app/source/kernel_functions.cpp#L10

@diamant3
Copy link
Member Author

I wouldn't use PPSSPP for testing kernel->user functionality. However, I know you should be able to use kuKernelCall like this: https://github.com/joel16/CMFileManager-PSP/blob/30b0be604e4ea9cf770bd4c56e7db1af8355fbbb/app/source/kernel_functions.cpp#L10

I'll take note of that, and thanks for the code! I'll try that one.

For now, I'll draft this because it's currently not working.

@diamant3 diamant3 marked this pull request as draft July 30, 2024 06:13
@sharkwouter sharkwouter removed their assignment Jul 30, 2024
@diamant3
Copy link
Member Author

I will close this PR because I can't get it to work, and this PR will probably get stuck in here.

Hopefully someone can work on this and solve the issue. Thanks.

@diamant3 diamant3 closed this Sep 10, 2024
@diamant3 diamant3 deleted the improve-sceGe branch September 10, 2024 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants