Skip to content

Commit

Permalink
SettingActivity: Support Limit FPS
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed Jul 10, 2023
1 parent 930cf13 commit 6b430fa
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 1 deletion.
2 changes: 2 additions & 0 deletions resources/i18n/en-US/wiliwili.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"vibration": "Gamepad vibration",
"hide_bottom": "Hide the hint bar below",
"hide_fps": "Hide FPS",
"limited_fps": "Maximum frame limit",
"limited_fps_vsync": "Vertical Synchronization",
"fullscreen": "Fullscreen",
"tv_search": "TV style search page",
"theme": {
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/zh-Hans/wiliwili.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"vibration": "手柄振动",
"hide_bottom": "隐藏下方提示栏",
"hide_fps": "隐藏 FPS",
"limited_fps": "最高帧数限制",
"limited_fps_vsync": "垂直同步",
"fullscreen": "全屏显示",
"tv_search": "电视风格搜索页",
"theme": {
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/zh-Hant/wiliwili.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"vibration": "手柄振動",
"hide_bottom": "隱藏下方提示欄",
"hide_fps": "隱藏 FPS",
"limited_fps": "最高幀數限制",
"limited_fps_vsync": "垂直同步",
"fullscreen": "全荧幕顯示",
"tv_search": "電視風格搜尋頁",
"theme": {
Expand Down
3 changes: 3 additions & 0 deletions resources/xml/activity/setting_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@
<brls:BooleanCell
id="setting/opencc"/>

<SelectorCell
id="setting/fps"/>

<SelectorCell
id="setting/keymap"/>

Expand Down
2 changes: 2 additions & 0 deletions scripts/ios/iOSBundleInfo.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,7 @@
<string>development</string>
<key>com.apple.developer.networking.multicast</key>
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
1 change: 1 addition & 0 deletions wiliwili/include/activity/setting_activity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class SettingActivity : public brls::Activity {
BRLS_BIND(SelectorCell, selectorFormat, "setting/video/format");
BRLS_BIND(SelectorCell, selectorCodec, "setting/video/codec");
BRLS_BIND(SelectorCell, selectorQuality, "setting/audio/quality");
BRLS_BIND(SelectorCell, selectorFPS, "setting/fps");
BRLS_BIND(TextBox, labelOpensource, "setting/label/opensource");
BRLS_BIND(brls::BooleanCell, cellHideBar, "cell/hideBottomBar");
BRLS_BIND(brls::BooleanCell, cellHideFPS, "cell/hideFPS");
Expand Down
16 changes: 16 additions & 0 deletions wiliwili/source/activity/setting_activity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,22 @@ void SettingActivity::onContentAvailable() {
brls::Application::setFPSStatus(!value);
});

/// Limited FPS
auto fpsOption = conf.getOptionData(SettingItem::LIMITED_FPS);
selectorFPS->init(
"wiliwili/setting/app/others/limited_fps"_i18n,
{"wiliwili/setting/app/others/limited_fps_vsync"_i18n,
"30",
"60",
"90",
"120"},
(size_t)conf.getIntOptionIndex(SettingItem::LIMITED_FPS), [fpsOption](int data) {
int fps = fpsOption.rawOptionList[data];
brls::Application::setLimitedFPS(fps);
ProgramConfig::instance().setSettingItem(SettingItem::LIMITED_FPS, fps);
return true;
});

/// TV Search Mode
cellTvSearch->init("wiliwili/setting/app/others/tv_search"_i18n,
conf.getBoolOption(SettingItem::SEARCH_TV_MODE),
Expand Down
2 changes: 1 addition & 1 deletion wiliwili/source/utils/config_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ std::unordered_map<SettingItem, ProgramOption> ProgramConfig::SETTING_MAP = {
{"0.5", "0.75", "1.0", "1.25", "1.5"},
{150, 125, 100, 75, 50},
2}},
{SettingItem::LIMITED_FPS, {"limited_fps", {}, {}, 0}},
{SettingItem::LIMITED_FPS, {"limited_fps", {"0","30","60","90","120"}, {0,30,60,90,120}, 0}},
{SettingItem::DEACTIVATED_TIME, {"deactivated_time", {}, {}, 0}},
{SettingItem::DEACTIVATED_FPS, {"deactivated_fps", {}, {}, 0}},
};
Expand Down

0 comments on commit 6b430fa

Please sign in to comment.