{"id":24737421,"url":"https://github.com/engineersbox/psx-minecraft","last_synced_at":"2025-10-10T06:32:00.907Z","repository":{"id":213248950,"uuid":"733383693","full_name":"EngineersBox/PSX-Minecraft","owner":"EngineersBox","description":"Remake of Minecraft for PS1 with PSn00bSDK","archived":false,"fork":false,"pushed_at":"2024-10-29T08:33:47.000Z","size":54916,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-29T09:52:26.349Z","etag":null,"topics":["minecraft","playstation","ps1","psn00bsdk","psx","psxmc"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EngineersBox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-19T07:54:43.000Z","updated_at":"2024-10-29T08:33:51.000Z","dependencies_parsed_at":"2024-11-06T06:35:14.117Z","dependency_job_id":null,"html_url":"https://github.com/EngineersBox/PSX-Minecraft","commit_stats":null,"previous_names":["engineersbox/psx-minecraft"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineersBox%2FPSX-Minecraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineersBox%2FPSX-Minecraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineersBox%2FPSX-Minecraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineersBox%2FPSX-Minecraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EngineersBox","download_url":"https://codeload.github.com/EngineersBox/PSX-Minecraft/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235930031,"owners_count":19067857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["minecraft","playstation","ps1","psn00bsdk","psx","psxmc"],"created_at":"2025-01-27T22:08:16.021Z","updated_at":"2025-10-10T06:31:50.897Z","avatar_url":"https://github.com/EngineersBox.png","language":"C","readme":"# PSX-Minecraft\n\nRemake of Minecraft for PS1 with PSn00bSDK\n\n\u003e [!NOTE]\n\u003e I am taking a brief break from this\n\u003e (just a couple of weeks) to work on\n\u003e other projects so as to not get burnt\n\u003e out. Don't worry, I'll be back to this\n\u003e soon, already have a design and implementation\n\u003e plans for better occullusion culling.\n\n**Table of Contents**\n\n\u003c!-- TOC --\u003e\n\n* [PSX-Minecraft](#psx-minecraft)\n  * [Dependencies](#dependencies)\n  * [References](#references)\n  * [Progress](#progress)\n    * [Goal](#goal)\n    * [Screenshots](#screenshots)\n      * [Breaking Blocks](#breaking-blocks)\n      * [Placing Blocks](#placing-blocks)\n      * [Item Drops](#item-drops)\n      * [Inventory](#inventory)\n      * [Sunlight Propagation](#sunlight-propagation)\n      * [Single Source Block Light](#single-source-block-light)\n      * [Multiple Source Block Light](#multiple-source-block-light)\n      * [Weather Raining](#weather-raining)\n      * [Crafting with Cursor](#crafting-with-cursor)\n      * [Hotbar Attributes](#hotbar-attributes)\n  * [Building](#building)\n  * [Docker Environment](#docker-environment)\n    * [Utility Build Script](#utility-build-script)\n  * [Development Scripts](#development-scripts)\n    * [Dependency Graph](#dependency-graph)\n    * [Resource Generator](#resource-generator)\n    * [Recipe Tree](#recipe-tree)\n  * [Development Environment](#development-environment)\n    * [CLion](#clion)\n    * [Neovim Clangd](#neovim-clangd)\n  * [Git Hooks](#git-hooks)\n\n\u003c!-- TOC --\u003e\n\n## Dependencies\n\n* Emulator: [PCSX Redux](https://github.com/grumpycoders/pcsx-redux)\n* PS1 Library: [PSn00bSDK](https://github.com/Lameguy64/PSn00bSDK)\n\n## References\n\n* [Inline programming reference](./docs/Inline%20Programming%20Reference.pdf)\n* [LibPSn00b reference](./docs/LibPSn00b%20Reference.pdf)\n* [Playstation specifications psx-spx](https://psx-spx.consoledev.net/kernelbios/)\n  (Everything from hardware to software in great detail)\n* [PsyQ Docs and examples](https://psx.arthus.net/sdk/Psy-Q/)\n* [IDT79R3xx (MIPS R3000A CPU) Data Sheet](./docs/IDT79R3xx_data_sheet.pdf)\n\n## Progress\n\n### Goal\n\n Current work is frustum culling, ordered directional sub-mesh culling and crafting system\n\n### Screenshots\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch4\u003eBreaking Blocks\u003c/h4\u003e\u003c/summary\u003e\n\n![Breaking Overlay](./docs/breaking_overlay.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch4\u003ePlacing Blocks\u003c/h4\u003e\u003c/summary\u003e\n\n![Placing Blocks](./docs/placing_blocks.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch4\u003eItem Drops\u003c/h4\u003e\u003c/summary\u003e\n\n![Item Drops](./docs/item_drops.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch4\u003eInventory\u003c/h4\u003e\u003c/summary\u003e\n\n\n![Inventory](./docs/inventory.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch4\u003eSunlight Propagation\u003c/h4\u003e\u003c/summary\u003e\n\n![Sunlight Propagation](./docs/sunlight.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch4\u003eSingle Source Block Light\u003c/h4\u003e\u003c/summary\u003e\n\n![Single Source Block Light](./docs/blocklight_single_source.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch4\u003eMultiple Source Block Light\u003c/h4\u003e\u003c/summary\u003e\n\n![Multiple Source Block Light](./docs/blocklight_multiple_source.png)\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch4\u003eWeather Raining\u003c/h4\u003e\u003c/summary\u003e\n\n![Weather Raining](./docs/weather_rain.png)\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch4\u003eCrafting with Cursor\u003c/h4\u003e\u003c/summary\u003e\n\n![Crafting with Cursor](./docs/crafting_inv_cursor.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch4\u003eHotbar Attributes\u003c/h4\u003e\u003c/summary\u003e\n\n![Hotbar Attributes](./docs/hotbar_attributes.png)\n\n\u003c/details\u003e\n\n## Building\n\nConfiguring the project can be done with\n\n```bash\ncmake --preset default .\n```\n\nThen the CD image can be built with\n\n```bash\ncmake --build ./build\n```\n\nThis will create several files in the `build` directory. Using the\nPCSX Redux emulator, you can load the `build/PSXMC.bin` CD image\nand run it.\n\n## Docker Environment\n\nDepending on the system you are building on (Windows/Linux/OSX) you may want to build locally,\nhowever, in the case that you are on OSX and want the ease of a development environment in\nLinux without the extra configuration headache, a Dockerfile has been provided that can be\nused with the `build_container.sh` script to build the project.\n\nFirst build the docker image, which will initialise a Linux distribution with all the necessary\ntooling and build the SDK. The following are optional arguments you can provide:\n\n* `--build-arg=\"REPO_TARGET=\u003cuser name\u003e/\u003crepo name\u003e\"` specify the namespaced repo (potential a fork) to build from. Defaults\n  to `Lameguy64/PSn00bSDK`.\n* `--build-arg=\"REPO_COMMIT_ISH=\u003cbranch/commit/tag\u003e\"` specify a build arg to target a specific branch/commit/tag of the SDK repo.\n  Defaults to `master`.\n* `--build-arg=\"GCC_MIPSEL_ELF_TAG=\u003cLameguy64/PSn00bSDK release tag\u003e\"` specify a release tag to pull the GCC build from.\n  Defaults to `v0.24`.\n* `--build-arg=PSN00BSDK_LIBC_ALLOCATOR=\u003cCUSTOM | AAF | TLSF\u003e` specify an allocator to use in the SDK build, must be one\n  of `CUSTOM`, `AAF` (allocated-first-fit), or `TLSF` (two-level-segregated-fit). This currently requires `EngineersBox/PSn00bSDK`\n  fork with `multiple-allocators` branch. Defaults to `TLSF`.\n* `--build-arg=\"CACHEBUST=$(date +%s)\"` force a rebuild of the repo. Defaults to `0`.\n\nUsing this, we can build as follows:\n\n```bash\ndocker build -t psxmc:latest -f Dockerfile .\n```\n\n### Utility Build Script\n\nUsing the above image, the utility script `build_container.sh` can be used to bundle assets\nand compile the project, it essentially does the work of running the image, mounting directories,\npassing the right flags, etc.\n\n```bash\nUsage: ./build_container.sh [\u003coptions\u003e]\nOptions:\n    -h | --help                Print this help message\n    -r | --rebuild             Clean the build directory and initialise CMake again (default: false)\n    -o | --output=\u003cdir\u003e        Set the directory to use as the build output (default: ./build)\n    -i | --image=\u003cimage:tag\u003e   Specify which image to use when building (default: psxmc:latest)\n```\n\n\u003e [!NOTE]\n\u003e Initially, you'll want to run it as `./build_container.sh --output=./build --rebuild`, but then for\n\u003e later rebuilds when making changes to code, just run `./build_container.sh`. Include `--output=\u003cdirectory\u003e`\n\u003e if you want to use a different directory than the default. Note that you'll need to use this option every\n\u003e time you run the command in that case.\n\n### Development Scripts\n\nThere are several scripts in the `scripts` and `root` directory that used for various development purposes. This section\ndetails the ones that are useful and how to use them.\n\n#### Dependency Graph\n\nThis generates a Graphviz compatible dependency graph in the DOT format, then exports to a desired rendered\nformat such as SVG, PNG, etc.\n\n```bash\nUsage: ./generate_include_graph.sh [\u003coptions\u003e]\nOptions:\n    -h | --help               Print this help message\n    -f | --format=\u003ctype\u003e      Output format of the graph. See https://graphviz.org/docs/outputs/ for valid values (default: svg)\n    -o | --output=\u003cfilename\u003e  Name of the generated graph file (default: graph.svg)\n```\n\n#### Resource Generator\n\nGame resources such as blocks and block items conform to a specific interface via `interface99` with some simplifying constructs,\nmacros, etc. The resource generator makes creating the header and sources necessary with markers to fill in where necessary.\n\nCurrently only blocks and block items supported, more will be added as the rest of the item/block types are implemented. See the following help outputs for the desired generation:\n\n* Block: `python3 scripts/resource_generator.py block --help`\n* Block item: `python3 scripts/resource_generator itemblock --help`\n\n#### Recipe Tree\n\nRecipes for any block or interface that uses them are generated as compile-time structures that are traversed\nvia the handlers in `src/game/recipe/recipe.h`. To support this, the `script/recipe_tree.py` script exists in\norder to convert a JSON definition of recipes into the structural definition as an extern in a given location.\nSee the output of `python3 scripts/recipe_tree.py --help` for more details.\n\n### Development Environment\n\n#### CLion\n\nYou can use the Dockerfile to double as a build environment for CLion so that you can run\nCMake within the Docker context attached to CLion. To the following to set this up:\n\n1. Open up settings and go to `Build, Execution, Deployment \u003e Toolchains`\n2. Create a new Docker toolchain and select the image you had build before\n3. Open the container settings\n4. Set the CMake option to `Docker CMake`\n5. Go to `Build, Execution, Deployment \u003e CMake`\n6. Create a new profile\n7. Set the toolchain to the Docker toolchain you just created\n8. Add `--preset default` to the CMake options field\n9. Exit settings\n10. Verify that the Docker daemon is running on your local\n11. Reload CMake project\n\n#### Neovim Clangd\n\n\u003e [!NOTE]\n\u003e This assumes you are using the `clangd` LSP using `nvim-lspconfig`, as it takes advantage\n\u003e of being able to customise the LSP instantiation command.\n\nWe will be modifying a standard configuration for customising the cmd provided by the\n`nvim-lspconfig` repo for running [LSPs in containers](https://github.com/neovim/nvim-lspconfig/wiki/Running-language-servers-in-containers).\n\nUsing the below configuration for the LSP, we will detect the project name, as the directory\nname of the highest level git repo (where `.git` is) from where the LSP is being instantiated\nfrom within neovim.\n\n```lua\nlocal root_pattern = lspconfig.util.root_pattern('.git')\nlocal function file_exists(name)\n   local f=io.open(name,\"r\")\n   if f ~= nil then io.close(f) return true else return false end\nend\n-- Might be cleaner to try to expose this as a pattern from `lspconfig.util`, as\n-- really it is just stolen from part of the `clangd` config\nlocal function format_clangd_command()\n    -- Turn the name of the current file into the name of an expected container, assuming that\n    -- the container running/building this file is named the same as the basename of the project\n    -- that the file is in\n    --\n    -- The name of the current buffer\n    local bufname = vim.api.nvim_buf_get_name(0)\n    -- Project root\n    local project_root = vim.loop.cwd()\n    -- Turned into a filename\n    local filename = lspconfig.util.path.is_absolute(bufname) and bufname or lspconfig.util.path.join(project_root, bufname)\n    -- Then the directory of the project\n    local project_dirname = root_pattern(filename) or lspconfig.util.path.dirname(filename)\n    -- And finally perform what is essentially a `basename` on this directory\n    local basename = vim.fn.fnamemodify(lspconfig.util.find_git_ancestor(project_dirname), ':t')\n    if (basename == nil) then\n        return nil\n    end\n    local name, _ = string.gsub(\n        string.lower(basename),\n        \"-\",\n        \"_\"\n    )\n    if (file_exists(project_root .. \"/cclangd\")) then\n        return { project_root .. \"/cclangd\" }\n    else\n        return { \"/usr/local/bin/cclangd\", name, project_root }\n    end\nend\nlspconfig[\"clangd\"].setup({\n    on_attach = on_attach,\n    cmd = format_clangd_command(),\n})\n```\n\nThere are some changes here to determine if the repo has a custom `cclangd` script, which allows us to create custom LSP configurations per-repo but also maintain a global behaviour with the script expected to be at `/usr/local/bin/cclangd`.\n\n```bash\n#!/bin/sh\n\nCONTAINER_NAME=\"psxmc\"\nPROJECT_ROOT_PATH=\"$(pwd)\"\n\n# Verify that a contianer by this name actually exists, and is running\nif [ -z \"$(docker ps -q -f name=\"$CONTAINER_NAME\" -f status=running)\" ]; then\n    echo \"[cclangd] No container running, determining existance of 'start_clangd.sh' script in project root\"\n    if [ -e \"$PROJECT_ROOT_PATH/start_clangd.sh\" ]; then\n        echo \"[cclangd] Start script exists in project root, invoking it to start container\"\n        exec \"$PROJECT_ROOT_PATH/start_clangd.sh\" \"$CONTAINER_NAME\" \"$PROJECT_ROOT_PATH\"\n    else\n        echo \"[cclangd] No start script exists in project root, starting on host\"\n        clangd --background-index\n    fi\nelse\n    echo \"[cclangd] Container running, executing inside it\"\n    # Important part here is both the '-i' and the redirection of STDERR\n    docker exec -i \"$1\" /usr/bin/clangd --background-index 2\u003e/dev/null\nfi\n```\n\nIn the custom `cclangd` script (within this repo and above), there is additional logic to launch the custom container context through `start_clangd.sh` with a custom container name (to avoid using hyphens with the current name and also cause I don't want to change the project name).\n\n```bash\n\n#!/bin/sh\n\nCONTAINER_NAME=\"$1\"\nPROJECT_ROOT_PATH=\"$2\"\n\ndocker run \\\n    -i \\\n    --rm \\\n    -v\"$PROJECT_ROOT_PATH:$PROJECT_ROOT_PATH\" \\\n    -w \"$PROJECT_ROOT_PATH\" \\\n    -e PSN00BSDK_LIBS=/opt/psn00bsdk/lib/libpsn00b \\\n    --name \"$CONTAINER_NAME\" \\\n    psxmc:latest \\\n    /bin/bash -c \"ln -s $PROJECT_ROOT_PATH /tmp/PSX-Minecraft \\\n    \u0026\u0026 ln -s $PROJECT_ROOT_PATH/.clangd /opt/psn00bsdk/include/libpsn00b/.clangd \\\n    \u0026\u0026 /usr/bin/clangd \\\n    --compile-commands-dir=\\\"${PROJECT_ROOT_PATH}/build\\\" \\\n    --background-index\"\n```\n\nSo assuming you have build the container image as per the instructions eariler in this README and named it `psxmc:latest`, this will launch `clangd` within a container using that image.\n\nAt this point your LSP configuration should work with `PSn00bSDK` (assuming the container paths match your local paths for the SDK) and the project sources without issue.\n\n## Git Hooks\n\nA custom git pre-commit hook is used to sort the TODO list so that unfinished items are grouped together\nin each sublist. This relies on hooks in a non-default location within the repository under `.githooks/`.\n\nIf you want to be able to use these, then you will need to run the following which will override the git\nconfig parameter `core.hooksPath` for only this cloned repository (does not affect your normal git config\nlocated in `~/.gitconfig`). If you have externally global hooks, then they will need to be reconciled\nmanually to work with this repository.\n\n```shell\ngit config --local core.hooksPath \"$(pwd)/.githooks\"\n```\n\nYou can of course also run these manually if you'd like to instead:\n\n```shell\n./.githooks/pre-commit\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineersbox%2Fpsx-minecraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fengineersbox%2Fpsx-minecraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineersbox%2Fpsx-minecraft/lists"}