Skip to content

Commit

Permalink
update stub
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Jan 5, 2024
1 parent cfc7529 commit f0934f6
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 19 deletions.
10 changes: 7 additions & 3 deletions docs/bulidtarget.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
我们的目标是编写能在PSP上运行的软件(常被称为`PSP Module`),从应用上可分为自制游戏(`Homebrew`)和插件(`Plugin`)。

> 参考阅读
> 一个关于PSPModule的文档,存在Github上某个项目中。
> 链接过会加上来
>
> PSP Modules, Exports, Imports and Patches https://uofw.github.io/upspd/docs/
在此之前,我们先了解一下PSP。

Expand Down Expand Up @@ -32,5 +32,9 @@ PSP推出以后,各路大神争相破解PSP固件,利用各种漏洞推出
对于自制游戏来说,为了能让其在主界面(`XMB`)的游戏菜单中显示,需要将其封装为EBOOT.PBP

示例:我们假设你已经拥有一台配备CFW的PSP

> A typical Plugin
> A typical Homebrew
> ![Leda Plugin](https://www.gamebrew.org/images/2/23/Ledapsp2.png)
> A typical Homebrew
> ![Dinorun](https://www.gamebrew.org/images/7/70/Dinorunpsp.png)
20 changes: 15 additions & 5 deletions docs/environment.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Set Up the Environment

在开始编写程序之前,我们需要首先配置好相关的环境。
参见:https://pspdev.github.io/

> 参见:https://pspdev.github.io/
注意:使用Ubuntu 22.04及以上版本

# Install PSPDEV Toolchain

## Dependencies
想使用PSPDev提供的工具链,首先需要安装以下依赖
```bash
Expand All @@ -29,6 +32,17 @@ wget URL
` tar -xvf pspdev-ubuntu-latest.tar.gz`

现在当前目录应该出现一个名为pspdev的文件夹。

------

## 使用VSCode远程连接之

### SSH
配置SSH
### 设置C/C++插件的includePath
VSCode并不知道你要用到的PSPSDK中的头文件在哪里,会标注红波浪线。在json配置文件中修改


## Git Proxy Config

```
Expand All @@ -40,7 +54,3 @@ git config --global https.proxy "http://"
git config --global --unset http.proxy
git config --global --unset https.proxy
```

## 使用VSCode远程连接之

## 安装SDL3
14 changes: 7 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
- [ ] 命令行工具详解(参数、源代码)
- [x] 引入第三方库(链接)
- [ ] 设备功能
- [ ] 显示
- [ ] 内置操作
- [ ] 弹窗
- [ ] 屏幕键盘
- [ ] 网络
- [ ] 视频解码
- [ ] I/O
- [ ] 显示
- [ ] 实用程序(Utility)
- [ ] 弹窗(Dialog)
- [ ] 屏幕键盘(On Screen Keyboard. A.k.a OSK)
- [ ] 网络
- [ ] 视频解码
- [ ] I/O
- [ ] PSPLink(调试)
- [ ] 发布
- [x] EBOOT.PBP
Expand Down
2 changes: 1 addition & 1 deletion docs/makefilesample.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## 推荐阅读

> 【【技术杂谈】C 编译体系】 https://www.bilibili.com/video/BV1J14y1D7Sw/?share_source=copy_web&vd_source=21fc443ef57d30a122c546adda50cd40
> 【【技术杂谈】C 编译体系】 https://www.bilibili.com/video/BV1J14y1D7Sw
> 【其他】make 到底干了些什么 http://bbs.chinaemu.org/read-htm-tid-86754-uid-12451.html
Expand Down
41 changes: 41 additions & 0 deletions docs/stublibs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Stub Libraries
> 推荐阅读
>
> `uofw` Github wiki https://github.com/uofw/uofw/wiki
>
> PSP Modules, Exports, Imports and Patches https://uofw.github.io/upspd/docs/
当我们之前链接第三方库时,都是直接与是真正包含代码的库链接。

现在我们希望在程序运行时动态地载入其他模块,依然可以使用静态链接,不过链接的是只包含函数接口和其空实现的存根库(`stub library`)。通过PSPSDK提供给我们的加载模块的函数,我们可以实现模块运行时的加载。

> Use other modules in your own module Dynamically.
## PSPSDK的库从哪里来?

事实上,我们目前为止链接的所有PSPSDK中内置库都是`Stub Libraries`

历史上,人们设法从索尼提供的官方固件升级包中提取出许多系统级`prx`模块,接着进行如下操作:

1. 从这些模块提取得到导出表(`Export Table`),了解其中包含的符号和位置,并利用他们生成存根库。
> ## 导出表(Export Table)
> `prx`文件的导出表可以类比Windows PE文件(如DLL文件)中的导出表。
>
>导出表包含了一个模块显式向其他模块公开供其使用的符号列表。
>
>导出表的关键组成部分包括:
>
>+ 导出的符号: 可以被其他模块访问和使用的函数、变量或资源的名称和地址。
>
>+ 序数号码(`NID`): 为每个导出的符号分配一个序数号码。序数号码提供了另一种引用导出符号的方式,特别是当名称没有被公开时。
>
>+ 地址或指针: 指示模块内导出函数或数据的位置的指针或地址。
得到了存根库后,我们理论上已经可以借此调用其中的函数了,但导出的函数若不知其含义,显然无从使用;且导出的函数名均以`sceMgr_driver_949CAC22`这样`库名+NID`的形式命名,不利于开发使用。

2. 对这些模块进行逆向工程,得到其机器语言实现,通过对汇编代码的研究理解其使用方法,以此整理出描述函数接口的头文件并修正导出的函数名。

通过这种方法,得到包含头文件和存根库的整个PSPSDK开发环境。

目前PSPSDK中有一些库的头文件中函数名仍带有奇怪的字符串,这实际上就是直接从导出表中得到的函数的`NID`,由于彼时尚不理解其具体实现,没有办法为其取名。

8 changes: 5 additions & 3 deletions docs/videoplayback.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
| MP4 (MPEG-4 Part 12) | 320 x 240 (QVGA)|MPEG-4 **Simple Profile** (MPEG-4 Part 2)|24000Hz|AAC|Non Statanrd Resolution & Bitrate 参见[YAPSPD <sup>1</sup>](#ref1)|
| PMF | can be as small as 64x64 pixels |H.264 (MPEG-4 Part 10 AVC)||ATRAC3plus|64kbps[<sup>2</sup>](https://www.sony.net/Products/ATRAC3/overview/)|

> **MPEG-4 Simple Profile** 在MPEG-4 Part 2 中定义,不同于 Advanced Simple Profile[<sup>3</sup>](https://en.wikipedia.org/wiki/MPEG-4_Part_2),更与H.264无关
依据互联网上存在的部分压制指南及官方文档,似乎最新固件上的视频播放器对分辨率和编码限制并不如此严格

> PSvid script on Github
> c:a aac -c:v libx264 -profile:v main -level:v 3.0 -x264opts ref=3:b-pyramid=none:weightp=1 -r 29.97 -s 320x240 -pix_fmt yuv420p -b:v 768k -ar 48000 -ab 96k
> `PSvid` script on `Github`
>
> ```ffmpeg -i sample.mp4 c:a aac -c:v libx264 -profile:v main -level:v 3.0 -x264opts ref=3:b-pyramid=none:weightp=1 -r 29.97 -s 320x240 -pix_fmt yuv420p -b:v 768k -ar 48000 -ab 96k```
> **MPEG-4 Simple Profile** 在MPEG-4 Part 2 中定义,不同于 Advanced Simple Profile[<sup>3</sup>](https://en.wikipedia.org/wiki/MPEG-4_Part_2),更与H.264无关

[OFW 6.60 Manual](https://manuals.playstation.net/document/en/psp/current/video/filetypes.html)

Expand Down
13 changes: 13 additions & 0 deletions docs/webrequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 进行网络请求

## PSP如何连接网络
### PSP支持的`Wi-Fi`协议
802.11b
### 在应用中连接网络
弹出弹窗,选择并连接

## 唤起网络连接弹窗 Network Dialog in PSPSDK

## `socket&http lib` in PSPSDK

## `curl` as PSPDEV package (enable https?)

0 comments on commit f0934f6

Please sign in to comment.