[gnome-games/wip/exalm/3ds: 8/8] Add a view switcher for 3ds
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/3ds: 8/8] Add a view switcher for 3ds
- Date: Sat, 5 Dec 2020 18:45:56 +0000 (UTC)
commit f7e52d83006c35857b7d9f184b8d1948128f8884
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sat Dec 5 18:21:12 2020 +0500
Add a view switcher for 3ds
.../icons/screen-layout-left-right-symbolic.svg | 70 ++++++++++++
.../icons/screen-layout-quick-switch-symbolic.svg | 66 ++++++++++++
.../icons/screen-layout-right-left-symbolic.svg | 71 ++++++++++++
.../icons/screen-layout-top-bottom-symbolic.svg | 71 ++++++++++++
.../data/icons/view-bottom-screen-symbolic.svg | 66 ++++++++++++
.../data/icons/view-top-screen-symbolic.svg | 66 ++++++++++++
plugins/nintendo-3ds/data/meson.build | 6 ++
.../nintendo-3ds/data/nintendo-3ds.gresource.xml | 13 +++
.../data/ui/nintendo-3ds-layout-item.ui | 51 +++++++++
.../data/ui/nintendo-3ds-layout-switcher.ui | 76 +++++++++++++
plugins/nintendo-3ds/src/meson.build | 6 +-
.../nintendo-3ds/src/nintendo-3ds-layout-item.vala | 32 ++++++
.../src/nintendo-3ds-layout-switcher.vala | 91 ++++++++++++++++
plugins/nintendo-3ds/src/nintendo-3ds-layout.vala | 103 ++++++++++++++++++
plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala | 9 +-
plugins/nintendo-3ds/src/nintendo-3ds-runner.vala | 120 +++++++++++++++++++++
16 files changed, 915 insertions(+), 2 deletions(-)
---
diff --git a/plugins/nintendo-3ds/data/icons/screen-layout-left-right-symbolic.svg
b/plugins/nintendo-3ds/data/icons/screen-layout-left-right-symbolic.svg
new file mode 100644
index 00000000..66c963f4
--- /dev/null
+++ b/plugins/nintendo-3ds/data/icons/screen-layout-left-right-symbolic.svg
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ id="svg8"
+ sodipodi:docname="ds-touchscreen-right.svg"
+ inkscape:version="0.92.2 2405546, 2018-03-11">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="2560"
+ inkscape:window-height="1376"
+ id="namedview10"
+ showgrid="true"
+ inkscape:zoom="64"
+ inkscape:cx="3.6767386"
+ inkscape:cy="8.1664307"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg8">
+ <inkscape:grid
+ type="xygrid"
+ id="grid4526" />
+ </sodipodi:namedview>
+ <g
+ id="g873">
+ <rect
+ y="5.5"
+ x="7.5"
+ height="6"
+ width="6"
+ id="rect869"
+
style="opacity:0.5;fill:#474747;fill-opacity:1;stroke:none;stroke-width:1.2544198;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
/>
+ <path
+ sodipodi:nodetypes="ssssssssscccccccccc"
+ inkscape:connector-curvature="0"
+ id="path4659-5"
+ d="M 15,6 C 15,5.057191 13.942809,4 13,4 H 2 C 1.057191,4 0,5.057191 0,6 v 5 c 0,0.942809 1.057191,2
2,2 h 11 c 0.942809,0 2,-1.057191 2,-2 z m -2,0 v 5 H 8 V 6 Z M 7,6 v 5 H 2 V 6 Z"
+
style="fill:#474747;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
/>
+ </g>
+</svg>
diff --git a/plugins/nintendo-3ds/data/icons/screen-layout-quick-switch-symbolic.svg
b/plugins/nintendo-3ds/data/icons/screen-layout-quick-switch-symbolic.svg
new file mode 100644
index 00000000..f2b61d32
--- /dev/null
+++ b/plugins/nintendo-3ds/data/icons/screen-layout-quick-switch-symbolic.svg
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ id="svg8"
+ sodipodi:docname="screen-layout-quick-switch-symbolic.svg"
+ inkscape:version="0.92.4 5da689c313, 2019-01-14">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ id="namedview10"
+ showgrid="true"
+ inkscape:zoom="32"
+ inkscape:cx="8.3953872"
+ inkscape:cy="9.5898251"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg8">
+ <inkscape:grid
+ type="xygrid"
+ id="grid4526" />
+ </sodipodi:namedview>
+ <path
+
style="opacity:0.5;fill:#474747;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 9,1 c 0.942809,0 1.999979,1.057191 2,2 V 4 H 9 V 3 H 3 v 6 h 1 v 2 H 3 C 2.057191,11
1.000021,9.942809 1,9 V 3 C 0.999979,2.057191 2.057191,1 3,1 Z"
+ id="path872"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccccccccsccss" />
+ <path
+ sodipodi:nodetypes="sccssccssccccc"
+ inkscape:connector-curvature="0"
+ id="path817"
+ d="m 13,5 c 0.942809,0 1.999979,1.057191 2,2 v 6 c 2.1e-5,0.942809 -1.057191,2 -2,2 H 7 C 6.057191,15
5.000021,13.942809 5,13 V 7 C 4.999979,6.057191 6.057191,5 7,5 Z m 0,2 H 7 v 6 h 6 z"
+
style="fill:#474747;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
/>
+</svg>
diff --git a/plugins/nintendo-3ds/data/icons/screen-layout-right-left-symbolic.svg
b/plugins/nintendo-3ds/data/icons/screen-layout-right-left-symbolic.svg
new file mode 100644
index 00000000..0219572b
--- /dev/null
+++ b/plugins/nintendo-3ds/data/icons/screen-layout-right-left-symbolic.svg
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ id="svg8"
+ sodipodi:docname="ds-touchscreen-left.svg"
+ inkscape:version="0.92.2 2405546, 2018-03-11">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="2560"
+ inkscape:window-height="1376"
+ id="namedview10"
+ showgrid="true"
+ inkscape:zoom="64"
+ inkscape:cx="3.6767386"
+ inkscape:cy="8.1664307"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg8">
+ <inkscape:grid
+ type="xygrid"
+ id="grid4526" />
+ </sodipodi:namedview>
+ <g
+ id="g873"
+ transform="matrix(-1,0,0,1,15,0)">
+ <rect
+ y="5.5"
+ x="7.5"
+ height="6"
+ width="6"
+ id="rect869"
+
style="opacity:0.5;fill:#474747;fill-opacity:1;stroke:none;stroke-width:1.2544198;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
/>
+ <path
+ sodipodi:nodetypes="ssssssssscccccccccc"
+ inkscape:connector-curvature="0"
+ id="path4659-5"
+ d="M 15,6 C 15,5.057191 13.942809,4 13,4 H 2 C 1.057191,4 0,5.057191 0,6 v 5 c 0,0.942809 1.057191,2
2,2 h 11 c 0.942809,0 2,-1.057191 2,-2 z m -2,0 v 5 H 8 V 6 Z M 7,6 v 5 H 2 V 6 Z"
+
style="fill:#474747;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
/>
+ </g>
+</svg>
diff --git a/plugins/nintendo-3ds/data/icons/screen-layout-top-bottom-symbolic.svg
b/plugins/nintendo-3ds/data/icons/screen-layout-top-bottom-symbolic.svg
new file mode 100644
index 00000000..5f633d76
--- /dev/null
+++ b/plugins/nintendo-3ds/data/icons/screen-layout-top-bottom-symbolic.svg
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ id="svg8"
+ sodipodi:docname="ds-touchscreen-bottom.svg"
+ inkscape:version="0.92.2 2405546, 2018-03-11">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="2560"
+ inkscape:window-height="1376"
+ id="namedview10"
+ showgrid="true"
+ inkscape:zoom="64"
+ inkscape:cx="3.6767386"
+ inkscape:cy="8.1664307"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg8">
+ <inkscape:grid
+ type="xygrid"
+ id="grid4526" />
+ </sodipodi:namedview>
+ <g
+ id="g873"
+ transform="matrix(0,1,1,0,-1,0)">
+ <rect
+ y="5.5"
+ x="7.5"
+ height="6"
+ width="6"
+ id="rect869"
+
style="opacity:0.5;fill:#474747;fill-opacity:1;stroke:none;stroke-width:1.2544198;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
/>
+ <path
+ sodipodi:nodetypes="ssssssssscccccccccc"
+ inkscape:connector-curvature="0"
+ id="path4659-5"
+ d="M 15,6 C 15,5.057191 13.942809,4 13,4 H 2 C 1.057191,4 0,5.057191 0,6 v 5 c 0,0.942809 1.057191,2
2,2 h 11 c 0.942809,0 2,-1.057191 2,-2 z m -2,0 v 5 H 8 V 6 Z M 7,6 v 5 H 2 V 6 Z"
+
style="fill:#474747;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
/>
+ </g>
+</svg>
diff --git a/plugins/nintendo-3ds/data/icons/view-bottom-screen-symbolic.svg
b/plugins/nintendo-3ds/data/icons/view-bottom-screen-symbolic.svg
new file mode 100644
index 00000000..fda93dbb
--- /dev/null
+++ b/plugins/nintendo-3ds/data/icons/view-bottom-screen-symbolic.svg
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ id="svg8"
+ sodipodi:docname="6-bottom.svg"
+ inkscape:version="0.92.4 5da689c313, 2019-01-14">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ id="namedview10"
+ showgrid="true"
+ inkscape:zoom="32"
+ inkscape:cx="1.5549575"
+ inkscape:cy="8.7612104"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg8">
+ <inkscape:grid
+ type="xygrid"
+ id="grid4526" />
+ </sodipodi:namedview>
+ <path
+ sodipodi:nodetypes="sccssccssscscccscscccs"
+ inkscape:connector-curvature="0"
+ id="path858"
+ d="m 9,1 c 0.942809,0 1.999979,1.057191 2,2 v 6 c 2.1e-5,0.942809 -1.057191,2 -2,2 H 3 C 2.057191,11
1.000021,9.942809 1,9 V 3 C 0.999979,2.057191 2.057191,1 3,1 Z M 4,4 H 3 V 5 C 3,5.31 3.09025,5.552
3.28125,5.75 L 6,8.4082031 8.71875,5.751953 C 8.90875,5.553953 9,5.311953 9,5.001953 v -1 H 8 c -0.257,0
-0.52775,0.1295 -0.71875,0.3125 L 6,5.59375 4.71875,4.314453 C 4.52875,4.131453 4.257,4 4,4 Z"
+
style="fill:#474747;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
/>
+ <path
+ inkscape:connector-curvature="0"
+ id="path818"
+ d="M 7,15 C 6.057191,15 5.000021,13.942809 5,13 v -1 h 2 v 1 h 6 V 7 H 12 V 5 h 1 c 0.942809,0
1.999979,1.057191 2,2 v 6 c 2.1e-5,0.942809 -1.057191,2 -2,2 z"
+
style="opacity:0.5;fill:#474747;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ sodipodi:nodetypes="sccccccccsccss" />
+</svg>
diff --git a/plugins/nintendo-3ds/data/icons/view-top-screen-symbolic.svg
b/plugins/nintendo-3ds/data/icons/view-top-screen-symbolic.svg
new file mode 100644
index 00000000..d9a3b696
--- /dev/null
+++ b/plugins/nintendo-3ds/data/icons/view-top-screen-symbolic.svg
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ id="svg8"
+ sodipodi:docname="6-top.svg"
+ inkscape:version="0.92.4 5da689c313, 2019-01-14">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ id="namedview10"
+ showgrid="true"
+ inkscape:zoom="32"
+ inkscape:cx="1.5549575"
+ inkscape:cy="8.7612104"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg8">
+ <inkscape:grid
+ type="xygrid"
+ id="grid4526" />
+ </sodipodi:namedview>
+ <path
+ sodipodi:nodetypes="sccssccssscscccscscccs"
+ inkscape:connector-curvature="0"
+ id="path858"
+ d="M 7,15 C 6.057191,15 5.000021,13.942809 5,13 V 7 C 4.999979,6.057191 6.057191,4.9999999 7,4.9999999
h 6 c 0.942809,0 1.999979,1.0571911 2,2.0000001 v 6 c 2.1e-5,0.942809 -1.057191,2 -2,2 z m 5,-3 h 1 v -1 c
0,-0.31 -0.09025,-0.552 -0.28125,-0.75 L 10,7.5917969 7.28125,10.248047 c -0.19,0.198 -0.28125,0.44
-0.28125,0.75 v 1 h 1 c 0.257,0 0.52775,-0.1295 0.71875,-0.3125 L 10,10.40625 11.28125,11.685547 C
11.47125,11.868547 11.743,12 12,12 Z"
+
style="fill:#474747;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
/>
+ <path
+ inkscape:connector-curvature="0"
+ id="path818"
+ d="m 9,1 c 0.942809,0 1.999979,1.057191 2,2 V 4 H 9 V 3 H 3 v 6 h 1 v 2 H 3 C 2.057191,11
1.000021,9.942809 1,9 V 3 C 0.999979,2.057191 2.057191,1 3,1 Z"
+
style="opacity:0.5;fill:#474747;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ sodipodi:nodetypes="sccccccccsccss" />
+</svg>
diff --git a/plugins/nintendo-3ds/data/meson.build b/plugins/nintendo-3ds/data/meson.build
index 0d4b6c49..a63a87eb 100644
--- a/plugins/nintendo-3ds/data/meson.build
+++ b/plugins/nintendo-3ds/data/meson.build
@@ -1 +1,7 @@
install_data (plugin_name + '.plugin', install_dir: plugins_dir)
+
+nintendo_3ds_resources = gnome.compile_resources (
+ 'nintendo-3ds',
+ 'nintendo-3ds.gresource.xml',
+ c_name: 'resources'
+)
diff --git a/plugins/nintendo-3ds/data/nintendo-3ds.gresource.xml
b/plugins/nintendo-3ds/data/nintendo-3ds.gresource.xml
new file mode 100644
index 00000000..2e0900c6
--- /dev/null
+++ b/plugins/nintendo-3ds/data/nintendo-3ds.gresource.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/Games/plugins/nintendo-3ds">
+ <file>ui/nintendo-3ds-layout-item.ui</file>
+ <file>ui/nintendo-3ds-layout-switcher.ui</file>
+ <file>icons/screen-layout-left-right-symbolic.svg</file>
+ <file>icons/screen-layout-quick-switch-symbolic.svg</file>
+ <file>icons/screen-layout-right-left-symbolic.svg</file>
+ <file>icons/screen-layout-top-bottom-symbolic.svg</file>
+ <file>icons/view-bottom-screen-symbolic.svg</file>
+ <file>icons/view-top-screen-symbolic.svg</file>
+ </gresource>
+</gresources>
diff --git a/plugins/nintendo-3ds/data/ui/nintendo-3ds-layout-item.ui
b/plugins/nintendo-3ds/data/ui/nintendo-3ds-layout-item.ui
new file mode 100644
index 00000000..dabf8b9b
--- /dev/null
+++ b/plugins/nintendo-3ds/data/ui/nintendo-3ds-layout-item.ui
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="3.24"/>
+ <template class="GamesNintendo3DsLayoutItem" parent="GtkListBoxRow">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkBox">
+ <property name="halign">start</property>
+ <property name="spacing">6</property>
+ <property name="valign">center</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkBox">
+ <property name="halign">start</property>
+ <property name="spacing">12</property>
+ <property name="valign">center</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImage" id="icon">
+ <property name="visible">True</property>
+ <style>
+ <class name="list-icon"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="title">
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage" id="checkmark">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <property name="halign">start</property>
+ <property name="opacity">0</property>
+ <property name="icon-name">emblem-ok-symbolic</property>
+ <style>
+ <class name="checkmark"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/plugins/nintendo-3ds/data/ui/nintendo-3ds-layout-switcher.ui
b/plugins/nintendo-3ds/data/ui/nintendo-3ds-layout-switcher.ui
new file mode 100644
index 00000000..419e4015
--- /dev/null
+++ b/plugins/nintendo-3ds/data/ui/nintendo-3ds-layout-switcher.ui
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="3.24"/>
+ <template class="GamesNintendo3DsLayoutSwitcher" parent="GtkBox">
+ <property name="visible">True</property>
+
+ <child>
+ <object class="GtkRevealer" id="change_screen_revealer">
+ <property name="visible">True</property>
+ <property name="transition-type">slide-left</property>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="margin-end">6</property>
+ <signal name="clicked" handler="on_screen_changed"/>
+ <child internal-child="accessible">
+ <object class="AtkObject">
+ <property name="accessible-name" translatable="yes">Change Screen</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage" id="change_screen_image">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuButton" id="layout_button">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="popover">layout_popover</property>
+ <signal name="notify::active" handler="on_menu_state_changed"/>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="a11y-display-discs">
+ <property name="accessible-name" translatable="yes">Screen Layout</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage" id="layout_image">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">pan-down-symbolic</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+ <object class="GtkPopover" id="layout_popover">
+ <property name="visible">False</property>
+ <signal name="show" handler="update_ui"/>
+ <child>
+ <object class="GtkListBox" id="list_box">
+ <property name="visible">True</property>
+ <property name="selection-mode">none</property>
+ <signal name="row-activated" handler="on_row_activated"/>
+ </object>
+ </child>
+ <style>
+ <class name="combo"/>
+ </style>
+ </object>
+</interface>
diff --git a/plugins/nintendo-3ds/src/meson.build b/plugins/nintendo-3ds/src/meson.build
index b1aadedb..c55f1f0e 100644
--- a/plugins/nintendo-3ds/src/meson.build
+++ b/plugins/nintendo-3ds/src/meson.build
@@ -1,6 +1,10 @@
vala_sources = [
'nintendo-3ds-header.vala',
+ 'nintendo-3ds-layout.vala',
+ 'nintendo-3ds-layout-item.vala',
+ 'nintendo-3ds-layout-switcher.vala',
'nintendo-3ds-plugin.vala',
+ 'nintendo-3ds-runner.vala',
]
c_args = [
@@ -9,7 +13,7 @@ c_args = [
shared_module (
'games-' + plugin_name + '-plugin',
- vala_sources,
+ vala_sources + nintendo_3ds_resources,
dependencies: gnome_games_dep,
c_args: c_args,
install: true,
diff --git a/plugins/nintendo-3ds/src/nintendo-3ds-layout-item.vala
b/plugins/nintendo-3ds/src/nintendo-3ds-layout-item.vala
new file mode 100644
index 00000000..213f66ad
--- /dev/null
+++ b/plugins/nintendo-3ds/src/nintendo-3ds-layout-item.vala
@@ -0,0 +1,32 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+[GtkTemplate (ui = "/org/gnome/Games/plugins/nintendo-3ds/ui/nintendo-3ds-layout-item.ui")]
+private class Games.Nintendo3DsLayoutItem : Gtk.ListBoxRow {
+ [GtkChild]
+ private Gtk.Image icon;
+ [GtkChild]
+ private Gtk.Label title;
+ [GtkChild]
+ private Gtk.Image checkmark;
+
+ public Nintendo3DsLayout layout { get; construct; }
+
+ public bool selected { get; set; default = false; }
+
+ public Nintendo3DsLayoutItem (Nintendo3DsLayout layout) {
+ Object (layout: layout);
+ }
+
+ construct {
+ notify["selected"].connect (() => {
+ checkmark.opacity = selected ? 1 : 0;
+ });
+ }
+
+ public override void constructed () {
+ icon.icon_name = layout.get_icon ();
+ title.label = layout.get_title ();
+
+ base.constructed ();
+ }
+}
diff --git a/plugins/nintendo-3ds/src/nintendo-3ds-layout-switcher.vala
b/plugins/nintendo-3ds/src/nintendo-3ds-layout-switcher.vala
new file mode 100644
index 00000000..29e00067
--- /dev/null
+++ b/plugins/nintendo-3ds/src/nintendo-3ds-layout-switcher.vala
@@ -0,0 +1,91 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+[GtkTemplate (ui = "/org/gnome/Games/plugins/nintendo-3ds/ui/nintendo-3ds-layout-switcher.ui")]
+private class Games.Nintendo3DsLayoutSwitcher : Gtk.Box, HeaderBarWidget {
+ [GtkChild]
+ private Gtk.Revealer change_screen_revealer;
+ [GtkChild]
+ private Gtk.Image change_screen_image;
+ [GtkChild]
+ private Gtk.MenuButton layout_button;
+ [GtkChild]
+ private Gtk.Image layout_image;
+ [GtkChild]
+ private Gtk.Popover layout_popover;
+ [GtkChild]
+ private Gtk.ListBox list_box;
+
+ private HashTable<Nintendo3DsLayout, Nintendo3DsLayoutItem> items;
+
+ public Nintendo3DsRunner runner { get; construct; }
+
+ private bool is_menu_open;
+ public bool block_autohide {
+ get { return is_menu_open; }
+ }
+
+ static construct {
+ var icon_theme = Gtk.IconTheme.get_default ();
+ icon_theme.add_resource_path ("/org/gnome/Games/plugins/nintendo-3ds/icons");
+ }
+
+ public override void constructed () {
+ items = new HashTable<Nintendo3DsLayout, Nintendo3DsLayoutItem> (direct_hash, direct_equal);
+ foreach (var layout in Nintendo3DsLayout.get_layouts ()) {
+ var item = new Nintendo3DsLayoutItem (layout);
+
+ items[layout] = item;
+ list_box.add (item);
+ }
+
+ update_ui ();
+
+ runner.notify["screen-layout"].connect (update_ui);
+ runner.notify["view-bottom-screen"].connect (update_ui);
+
+ base.constructed ();
+ }
+
+ public Nintendo3DsLayoutSwitcher (Nintendo3DsRunner runner) {
+ Object (runner: runner);
+ }
+
+ [GtkCallback]
+ private void on_menu_state_changed () {
+ is_menu_open = layout_button.active;
+ notify_property ("block-autohide");
+ }
+
+ [GtkCallback]
+ private void update_ui () {
+ var layout = runner.screen_layout;
+ var view_bottom = runner.view_bottom_screen;
+
+ layout_image.icon_name = layout.get_icon ();
+
+ foreach (var item in items.get_values ())
+ item.selected = item.layout == layout;
+
+ var item = items[layout];
+ list_box.select_row (item);
+
+ change_screen_revealer.reveal_child = (layout == Nintendo3DsLayout.QUICK_SWITCH);
+ change_screen_image.icon_name = view_bottom ?
+ "view-top-screen-symbolic" :
+ "view-bottom-screen-symbolic";
+ }
+
+ [GtkCallback]
+ private void on_screen_changed (Gtk.Button button) {
+ runner.view_bottom_screen = !runner.view_bottom_screen;
+ }
+
+ [GtkCallback]
+ private void on_row_activated (Gtk.ListBoxRow row) {
+ var layout_item = row as Nintendo3DsLayoutItem;
+
+ runner.screen_layout = layout_item.layout;
+
+ layout_popover.popdown ();
+ }
+}
diff --git a/plugins/nintendo-3ds/src/nintendo-3ds-layout.vala
b/plugins/nintendo-3ds/src/nintendo-3ds-layout.vala
new file mode 100644
index 00000000..d5ba5e90
--- /dev/null
+++ b/plugins/nintendo-3ds/src/nintendo-3ds-layout.vala
@@ -0,0 +1,103 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+public enum Games.Nintendo3DsLayout {
+ TOP_BOTTOM,
+ LEFT_RIGHT,
+ RIGHT_LEFT,
+ QUICK_SWITCH;
+
+ public string get_value () {
+ switch (this) {
+ case TOP_BOTTOM:
+ return "Default Top-Bottom Screen";
+
+ case LEFT_RIGHT:
+ case RIGHT_LEFT:
+ return "Side by Side";
+
+ case QUICK_SWITCH:
+ return "Single Screen Only";
+
+ default:
+ assert_not_reached ();
+ }
+ }
+
+ public string get_icon () {
+ switch (this) {
+ case TOP_BOTTOM:
+ return "screen-layout-top-bottom-symbolic";
+
+ case LEFT_RIGHT:
+ return "screen-layout-left-right-symbolic";
+
+ case RIGHT_LEFT:
+ return "screen-layout-right-left-symbolic";
+
+ case QUICK_SWITCH:
+ return "screen-layout-quick-switch-symbolic";
+
+ default:
+ assert_not_reached ();
+ }
+ }
+
+ public string get_title () {
+ switch (this) {
+ case TOP_BOTTOM:
+ /* Translators: This describes the layout for the Nintendo DS
+ * emulator. This setting means the two screens are stacked one on
+ * top of the other */
+ return _("Vertical");
+
+ case LEFT_RIGHT:
+ /* Translators: This describes the layout for the Nintendo DS
+ * emulator. This setting means the two screens are displayed side
+ * by side and not one on top of the other. The bottom screen
+ * (which is the touch screen) is displayed to the right of the top
+ * screen, making it comfortable for right-handed persons. */
+ return _("Side by side, right-handed");
+
+ case RIGHT_LEFT:
+ /* Translators: This describes the layout for the Nintendo DS
+ * emulator. This setting means the two screens are displayed side
+ * by side and not one on top of the other. The bottom screen
+ * (which is the touch screen) is displayed to the left of the top
+ * screen, making it comfortable for left-handed persons. */
+ return _("Side by side, left-handed");
+
+ case QUICK_SWITCH:
+ /* Translators: This describes the layout for the Nintendo DS
+ * emulator. This setting means only one screen is displayed at
+ * once. The screen displayed can then be changed in-game. */
+ return _("Single screen");
+
+ default:
+ assert_not_reached ();
+ }
+ }
+
+ public static Nintendo3DsLayout[] get_layouts () {
+ return { TOP_BOTTOM, LEFT_RIGHT, RIGHT_LEFT, QUICK_SWITCH };
+ }
+
+ public static Nintendo3DsLayout? from_value (string value) {
+ switch (value) {
+ case "top/bottom":
+ return TOP_BOTTOM;
+
+ case "left/right":
+ return LEFT_RIGHT;
+
+ case "right/left":
+ return RIGHT_LEFT;
+
+ case "quick switch":
+ return QUICK_SWITCH;
+
+ default:
+ warning ("Unknown screen layout: %s\n", value);
+ return null;
+ }
+ }
+}
diff --git a/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
b/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
index 976dc76b..d570e2d7 100644
--- a/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
+++ b/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
@@ -32,7 +32,8 @@ private class Games.Nintendo3DsPlugin : Object, Plugin {
}
public RunnerFactory[] get_runner_factories () {
- var factory = new RetroRunnerFactory (platform);
+ var factory = new GenericRunnerFactory (create_runner);
+ factory.add_platform (platform);
return { factory };
}
@@ -58,6 +59,12 @@ private class Games.Nintendo3DsPlugin : Object, Plugin {
return game;
}
+
+ private static Runner? create_runner (Game game) throws Error {
+ var core_source = new RetroCoreSource (platform);
+
+ return new Nintendo3DsRunner (game, core_source);
+ }
}
[ModuleInit]
diff --git a/plugins/nintendo-3ds/src/nintendo-3ds-runner.vala
b/plugins/nintendo-3ds/src/nintendo-3ds-runner.vala
new file mode 100644
index 00000000..7cad475d
--- /dev/null
+++ b/plugins/nintendo-3ds/src/nintendo-3ds-runner.vala
@@ -0,0 +1,120 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+private class Games.Nintendo3DsRunner : RetroRunner {
+ // Map the 1,2,3,4 key values to the 4 screen layouts of the Nintendo 3DS
+ private static HashTable<uint, Nintendo3DsLayout?> layouts;
+
+ private const string SCREENS_LAYOUT_OPTION = "citra_layout_option";
+ private const string PROMINENT_SCREEN_OPTION = "citra_swap_screen";
+
+ private const size_t HEADER_GAME_CODE_OFFSET = 12;
+ private const size_t HEADER_GAME_CODE_SIZE = 3;
+
+ private Nintendo3DsLayout _screen_layout;
+ public Nintendo3DsLayout screen_layout {
+ get { return _screen_layout; }
+ set {
+ _screen_layout = value;
+ update_screen_layout ();
+ }
+ }
+
+ private bool _view_bottom_screen;
+ public bool view_bottom_screen {
+ get { return _view_bottom_screen; }
+ set {
+ _view_bottom_screen = value;
+ update_screen_layout ();
+ }
+ }
+
+ static construct {
+ layouts = new HashTable<uint, Nintendo3DsLayout?> (direct_hash, direct_equal);
+
+ layouts[Gdk.Key.@1] = Nintendo3DsLayout.TOP_BOTTOM;
+ layouts[Gdk.Key.@2] = Nintendo3DsLayout.LEFT_RIGHT;
+ layouts[Gdk.Key.@3] = Nintendo3DsLayout.RIGHT_LEFT;
+ layouts[Gdk.Key.@4] = Nintendo3DsLayout.QUICK_SWITCH;
+ }
+
+ public Nintendo3DsRunner (Game game, RetroCoreSource source) {
+ base.from_source (game, source);
+ }
+
+ private bool core_supports_layouts () {
+ var core = get_core ();
+
+ return core != null && core.has_option (SCREENS_LAYOUT_OPTION) && core.has_option
(PROMINENT_SCREEN_OPTION);
+ }
+
+ private void update_screen_layout () {
+ if (!core_supports_layouts ())
+ return;
+
+ var core = get_core ();
+
+ var screens_layout_option = core.get_option (SCREENS_LAYOUT_OPTION);
+ var prominent_screen_option = core.get_option (PROMINENT_SCREEN_OPTION);
+
+ var screens_layout_option_value = screen_layout.get_value ();
+ bool use_bottom_screen = false;
+
+ if (screen_layout == Nintendo3DsLayout.RIGHT_LEFT)
+ use_bottom_screen = true;
+
+ if (screen_layout == Nintendo3DsLayout.QUICK_SWITCH)
+ use_bottom_screen = view_bottom_screen;
+
+ try {
+ screens_layout_option.set_value (screens_layout_option_value);
+ prominent_screen_option.set_value (use_bottom_screen ? "Bottom" : "Top");
+ }
+ catch (Error e) {
+ critical ("Failed to set desmume option: %s", e.message);
+ }
+ }
+
+ public override HeaderBarWidget? get_extra_widget () {
+ if (!core_supports_layouts ())
+ return null;
+
+ return new Nintendo3DsLayoutSwitcher (this);
+ }
+
+ public override bool key_press_event (uint keyval, Gdk.ModifierType state) {
+ if (state == Gdk.ModifierType.MOD1_MASK) {
+ // Alt + 1|2|3|4
+ var shortcut_layout = layouts[keyval];
+ if (shortcut_layout != null) {
+ screen_layout = shortcut_layout;
+
+ return true;
+ }
+ }
+
+ if (screen_layout != Nintendo3DsLayout.QUICK_SWITCH)
+ return false;
+
+ var switch_keyval = view_bottom_screen ? Gdk.Key.Page_Up : Gdk.Key.Page_Down;
+ if (keyval == switch_keyval)
+ return swap_screens ();
+
+ return false;
+ }
+
+ public override bool gamepad_button_press_event (uint16 button) {
+ if (button == EventCode.BTN_THUMBR)
+ return swap_screens ();
+
+ return false;
+ }
+
+ private bool swap_screens () {
+ if (screen_layout != Nintendo3DsLayout.QUICK_SWITCH)
+ return false;
+
+ view_bottom_screen = !view_bottom_screen;
+
+ return true;
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]