| 1767 | } |
| 1768 | |
| 1769 | error_code cellGameGetParamString(s32 id, vm::ptr<char> buf, u32 bufsize) |
| 1770 | { |
| 1771 | cellGame.warning("cellGameGetParamString(id=%d, buf=*0x%x, bufsize=%d)", id, |
| 1772 | buf, bufsize); |
| 1773 | |
| 1774 | if (!buf || bufsize == 0) |
| 1775 | { |
| 1776 | return CELL_GAME_ERROR_PARAM; |
| 1777 | } |
| 1778 | |
| 1779 | auto& perm = g_fxo->get<content_permission>(); |
| 1780 | |
| 1781 | lv2_sleep(2000); |
| 1782 | |
| 1783 | const auto init = acquire_access_lock(perm.init); |
| 1784 | |
| 1785 | if (!init || perm.mode == content_permission::check_mode::not_set) |
| 1786 | { |
| 1787 | return CELL_GAME_ERROR_FAILURE; |
| 1788 | } |
| 1789 | |
| 1790 | const auto key = get_param_string_key(id); |
| 1791 | |
| 1792 | if (key.name.empty()) |
| 1793 | { |
| 1794 | return CELL_GAME_ERROR_INVALID_ID; |
| 1795 | } |
| 1796 | |
| 1797 | if (!key.is_supported(false, perm.mode)) |
| 1798 | { |
| 1799 | // TODO: this error is possibly only returned during debug mode |
| 1800 | return {CELL_GAME_ERROR_NOTSUPPORTED, |
| 1801 | "id %d is not supported in the current check mode: %s", id, |
| 1802 | perm.mode.load()}; |
| 1803 | } |
| 1804 | |
| 1805 | const auto value = psf::get_string(perm.sfo, key.name); |
| 1806 | |
| 1807 | if (value.empty() && !perm.sfo.count(std::string(key.name))) |
| 1808 | { |
| 1809 | // TODO: Check if special values need to be set here |
| 1810 | cellGame.warning("cellGameGetParamString(): id=%d was not found", id); |
| 1811 | } |
| 1812 | |
| 1813 | std::span dst(buf.get_ptr(), bufsize); |
| 1814 | strcpy_trunc(dst, value); |
| 1815 | return CELL_OK; |
| 1816 | } |
| 1817 | |
| 1818 | error_code cellGameSetParamString(s32 id, vm::cptr<char> buf) |
| 1819 | { |
nothing calls this directly
no test coverage detected