Skip to content

Commit

Permalink
Support non-libnx NROs
Browse files Browse the repository at this point in the history
  • Loading branch information
PixelyIon committed Jul 3, 2019
1 parent 2bf88e1 commit 4da7a9c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
14 changes: 10 additions & 4 deletions app/src/main/java/gq/cyuubi/lightswitch/FileAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ class GameItem {

int index;

public GameItem(File file) {
public GameItem(File file, Context ctx) {
this.file = file;
index = file.getName().lastIndexOf(".");
meta = NroMeta.getTitleEntry(getPath());
if(meta==null) {
meta = new TitleEntry(file.getName(), ctx.getString(R.string.aset_missing), null);
}
}

public Bitmap getIcon() {
Expand All @@ -39,7 +42,7 @@ public String getTitle() {
return meta.getName() + " (" + getType() + ")";
}

public String getAuthor() {
public String getSubTitle() {
return meta.getAuthor();
}

Expand Down Expand Up @@ -93,8 +96,11 @@ public View getView(int position, View convertView, ViewGroup parent) {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.txtTitle.setText(dataModel.getTitle());
viewHolder.txtSub.setText(dataModel.getAuthor());
viewHolder.icon.setImageBitmap(dataModel.getIcon());
viewHolder.txtSub.setText(dataModel.getSubTitle());
Bitmap icon = dataModel.getIcon();
if(icon!=null) {
viewHolder.icon.setImageBitmap(icon);
}
viewHolder.icon.setOnClickListener(this);
viewHolder.icon.setTag(position);
return convertView;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/gq/cyuubi/lightswitch/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void refresh_files() {
adapter.clear();
List<File> files = findFile("nro", new File(sharedPreferences.getString("search_location", "")), null);
for (File file : files) {
adapter.add(new GameItem(file));
adapter.add(new GameItem(file, getApplicationContext()));
}
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<!-- Main -->
<string name="refresh_string">The list of ROMs has been refreshed.</string>
<string name="launch_string">Launching</string>
<string name="aset_missing">ASET Header Missing</string>
<string name="icon">Icon</string>
<!-- Settings -->
<string name="search">Search</string>
Expand Down

0 comments on commit 4da7a9c

Please sign in to comment.