MCPcopy Create free account
hub / github.com/GrapheneCt/NetStream / DefaultFsSort

Method DefaultFsSort

NetStream/source/browsers/local_server_browser.cpp:105–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105bool LocalServerBrowser::DefaultFsSort(const LocalServerBrowser::Entry *a, const LocalServerBrowser::Entry *b)
106{
107 sce::AppSettings *settings = menu::Settings::GetAppSetInstance();
108
109 int32_t nameSort = 0;
110 int32_t typeSort = 0;
111 bool isFolderA = a->type == LocalServerBrowser::Entry::Type_Folder;
112 bool isFolderB = b->type == LocalServerBrowser::Entry::Type_Folder;
113 settings->GetInt("local_sort_name", (int32_t *)&nameSort, 0);
114 settings->GetInt("local_sort_type", (int32_t *)&typeSort, 0);
115
116 switch (typeSort)
117 {
118 case 0:
119 if (isFolderA && !isFolderB)
120 {
121 return true;
122 }
123 else if (!isFolderA && isFolderB)
124 {
125 return false;
126 }
127 break;
128 case 1:
129 if (isFolderA && !isFolderB)
130 {
131 return false;
132 }
133 else if (!isFolderA && isFolderB)
134 {
135 return true;
136 }
137 break;
138 }
139
140 int32_t ret = sce_paf_strcasecmp(a->ref.c_str(), b->ref.c_str());
141
142 switch (nameSort)
143 {
144 case 0:
145 if (ret <= 0)
146 {
147 return true;
148 }
149 else
150 {
151 return false;
152 }
153 case 1:
154 if (ret <= 0)
155 {
156 return false;
157 }
158 else
159 {
160 return true;
161 }
162 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected