Share your webMAN-MOD code

Discussion in 'webMAN MOD' started by haxxxen, Oct 24, 2016.

  1. 360
    159
    53
    haxxxen

    haxxxen Developer

    Joined:
    Oct 16, 2014
    Messages:
    360
    Likes Received:
    159
    Trophy Points:
    53
    i have added a prxloader myself to my webman mod, so i can load and attach them to game process. this way you can load mod menus or this trophy unlocker plugin.

    if anybody is interested:
    Code:
    #define MYSPRX "/dev_hdd0/z/prx/MySPRX.sprx"
    #define CONFIG_HDD "/dev_hdd0/sprx.txt"
    static int32_t load_plugin_to_game(uint64_t prx_path, void *arg, uint32_t arg_size)
    {
    int32_t r;
    char pid_str[128];
    uint32_t pid_list[16];
    sys_prx_id_t game_pid = 0;
    {system_call_2(11, SYSCALL11_OPCODE_GET_ALL_PROC_PID, (uint64_t)((uint32_t)pid_list));}
    for(int i = 0; i < 16; i++)
    {
    if (1 < pid_list)
    {
    memset(pid_str, 0, sizeof(pid_str));
    {system_call_3(11, SYSCALL11_OPCODE_GET_PROC_NAME_BY_PID, (uint64_t)((uint32_t)pid_list), (uint64_t)((uint32_t)pid_str));}
    if (strstr(pid_str, "EBOOT"))
    {
    game_pid = pid_list;
    break;
    }
    // else if ((strstr(pid_str, "vsh") == NULL) && (strstr(pid_str, "agent") == NULL) && (strstr(pid_str, "sys") == NULL))
    else if ((!strstr(pid_str, "vsh")) && (!strstr(pid_str, "agent")) && (!strstr(pid_str, "sys")))
    {
    // in case it's a self
    game_pid = pid_list;
    break;
    }
    }
    }
    {system_call_5(11, SYSCALL11_OPCODE_LOAD_PROC_MODULE, (uint64_t)game_pid, (uint64_t)((uint32_t)prx_path), (uint64_t)((uint32_t)arg), (uint64_t)((uint32_t)arg_size)); r = (int32_t)p1;}
    return(r);
    }
    static int check_for_booted_game(void)
    {
    int32_t r;
    if (FindLoadedPlugin("game_plugin") != 0)
    {
    char line[256];
    int len;
    char tmp[256];
    FILE * f = fopen(CONFIG_HDD,"r");
    if(!f)
    {
    r = load_plugin_to_game((uint64_t)MYSPRX, 0, 0);
    if (r == 0)
    {
    plugin_running = IN_GAME;
    sprintf((char*)tmp, "PRX geladen\n%s", MYSPRX);
    show_msg((char*)tmp);
    sys_timer_sleep(1);
    }
    else
    {
    sprintf((char*)tmp, "PRX Fehler\n%s", MYSPRX);
    show_msg((char*)tmp);
    sys_timer_sleep(1);
    }
    goto exit;
    }
    while(fgets(line, sizeof line, f) != NULL)
    {
    len = strlen(line);
    if(line[0] != '/' || len == 0) continue;
    if(line[len-1] == '\n') line[len-1] = 0;
    if(line[len-2] == '\r') line[len-2] = 0;
    r = load_plugin_to_game((uint64_t)((uint32_t)line), 0, 0);
    if (r == 0)
    {
    plugin_running = IN_GAME;
    sprintf((char*)tmp, "PRX geladen\nPFAD: %s", line);
    show_msg((char*)tmp);
    sys_timer_sleep(1);
    }
    else
    {
    sprintf((char*)tmp, "PRX Fehler\nPFAD: %s", line);
    show_msg((char*)tmp);
    sys_timer_sleep(1);
    }
    }
    fclose(f);
    }
    exit:
    return CELL_OK;
    }
    to call the plugin i am using:
    Code:
    if (data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_R1)
    {
    if (data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_CIRCLE)
    { // R1+O (load game plugin)
    if(vshmain_EB757101() != 0) // if game has booted
    {
    check_for_booted_game();
    }
    }
    it is based on prxloader and the game menu plugin from @OsirisX
    i just have changed syscall8 to syscall11
     
    Last edited: Oct 24, 2016
  2. 4,604
    2,572
    123
    bguerville

    bguerville Moderator Developer

    Joined:
    Feb 25, 2015
    Messages:
    4,604
    Likes Received:
    2,572
    Trophy Points:
    123
    Location:
    Earth
    STLcardsWS and aldostools like this.
  3. 16
    39
    13
    mysis

    mysis Developer

    Joined:
    Jan 29, 2016
    Messages:
    16
    Likes Received:
    39
    Trophy Points:
    13
    I use vshmain_624D3AE() which retrieves the loaded game pid :)
     

Share This Page