Move to JRE8, store/restore CD or DVD user selection, fix issue when file was not actually deleted till application closed, add few cosmetic changes to pom.xml, insert screenshot to README.md
This commit is contained in:
parent
dc6e3151d0
commit
4b748e62f7
9 changed files with 64 additions and 41 deletions
|
@ -4,6 +4,8 @@
|
|||
|
||||
OPL-compatible PS2 tool for making split files. Sort of ul.cfg manager or USBUtil.
|
||||
|
||||
![Application screenshot](screenshots/1.png)
|
||||
|
||||
#### Let's stay in touch
|
||||
|
||||
GitHubs are arising and passing, cozy mirrors are eternal: https://git.redrise.ru/desu/Tihwin
|
||||
|
|
8
pom.xml
8
pom.xml
|
@ -4,15 +4,15 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>loper</groupId>
|
||||
<groupId>ru.redrise</groupId>
|
||||
<name>Tihwin</name>
|
||||
|
||||
<artifactId>Tihwin</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.1</version>
|
||||
|
||||
<url>https://github.com/developersu/${project.artifactId}/</url>
|
||||
<description>
|
||||
NS Atmosphere dongle flash tool
|
||||
OPL-compatible PS2 tool for making split files. Sort of ul.cfg manager or USBUtil.
|
||||
</description>
|
||||
<inceptionYear>2022</inceptionYear>
|
||||
<organization>
|
||||
|
@ -36,7 +36,7 @@
|
|||
<role>Developer</role>
|
||||
</roles>
|
||||
<timezone>+3</timezone>
|
||||
<url>https://developersu.blogspot.com/</url>
|
||||
<url>https://redrise.ru/</url>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
|
|
BIN
screenshots/1.png
Normal file
BIN
screenshots/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
|
@ -72,7 +72,10 @@ public class MainAppUi extends JFrame {
|
|||
destinationSelectBtn.addActionListener(actionEvent -> destinationSelectEventHandler());
|
||||
convertBtn.addActionListener(actionEvent -> convertButtonAction());
|
||||
((AbstractDocument) titleField.getDocument()).setDocumentFilter(new TitleFieldFilter());
|
||||
|
||||
if (Settings.INSTANCE.getDvdSelected())
|
||||
DVDRadioButton.setSelected(true);
|
||||
else
|
||||
CDRadioButton.setSelected(true);
|
||||
recentRomLocation = Settings.INSTANCE.getRomLocation();
|
||||
destinationDirectoryLbl.setText(FilesHelper.getRealFolder(Settings.INSTANCE.getDestination()));
|
||||
|
||||
|
@ -90,6 +93,7 @@ public class MainAppUi extends JFrame {
|
|||
public void windowClosing(WindowEvent windowEvent) {
|
||||
Settings.INSTANCE.setRomLocation(recentRomLocation);
|
||||
Settings.INSTANCE.setDestination(destinationDirectoryLbl.getText());
|
||||
Settings.INSTANCE.setDvdSelected(DVDRadioButton.isSelected());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,6 +35,9 @@ public class Settings {
|
|||
public String getDestination(){
|
||||
return preferences.get("destination", System.getProperty("user.home"));
|
||||
}
|
||||
public boolean getDvdSelected(){
|
||||
return preferences.getBoolean("dvd_selected", true);
|
||||
}
|
||||
|
||||
public void setDestination(String location){
|
||||
preferences.put("destination", location);
|
||||
|
@ -42,4 +45,7 @@ public class Settings {
|
|||
public void setRomLocation(String location){
|
||||
preferences.put("rom_location", location);
|
||||
}
|
||||
public void setDvdSelected(boolean value) {
|
||||
preferences.putBoolean("dvd_selected", value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
package tihwin.ul;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
|
@ -85,14 +86,14 @@ public class UlConfiguration {
|
|||
public byte[] generateUlConfig(){
|
||||
ByteBuffer byteBuffer = ByteBuffer.allocate(0x40);
|
||||
byteBuffer.put(title.getBytes(StandardCharsets.US_ASCII));
|
||||
byteBuffer.position(32);
|
||||
((Buffer) byteBuffer).position(32);
|
||||
byteBuffer.put(("ul."+publisherTitle).getBytes());
|
||||
byteBuffer.position(32+15);
|
||||
((Buffer) byteBuffer).position(32+15);
|
||||
byteBuffer.put(chunksCount);
|
||||
byteBuffer.put(cdDvdFlag);
|
||||
byteBuffer.position(53);
|
||||
((Buffer) byteBuffer).position(53);
|
||||
byteBuffer.put((byte) 0x8); // weird. no idea why it's here
|
||||
byteBuffer.flip();
|
||||
((Buffer) byteBuffer).flip();
|
||||
return byteBuffer.array();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,8 +69,12 @@ public class UlMaker implements Runnable{
|
|||
safeShutdown();
|
||||
}
|
||||
catch (Exception e){
|
||||
updater.setStatus(resourceBundle.getString("FailedText")+" "+e.getMessage());
|
||||
e.printStackTrace();
|
||||
if (! interrupted()) {
|
||||
updater.setStatus(resourceBundle.getString("FailedText") + " " + e.getMessage());
|
||||
return;
|
||||
}
|
||||
safeShutdown();
|
||||
}
|
||||
finally {
|
||||
updater.close();
|
||||
|
@ -78,11 +82,11 @@ public class UlMaker implements Runnable{
|
|||
}
|
||||
|
||||
private void safeShutdown() {
|
||||
updater.setStatus(resourceBundle.getString("PleaseWaitText"));
|
||||
try{
|
||||
boolean isDeleted = true;
|
||||
for (int i = 0; i < ulConfiguration.getChunksCount(); i++) {
|
||||
File chunkFile = new File(String.format(locationPattern, i));
|
||||
if (chunkFile.exists())
|
||||
isDeleted &= chunkFile.delete();
|
||||
isDeleted &= Files.deleteIfExists(Paths.get(String.format(locationPattern, i)));
|
||||
}
|
||||
|
||||
if (isDeleted)
|
||||
|
@ -90,14 +94,19 @@ public class UlMaker implements Runnable{
|
|||
else
|
||||
updater.setStatus(resourceBundle.getString("InterruptedAndFilesNotDeletedText"));
|
||||
}
|
||||
catch (Exception e){
|
||||
updater.setStatus(resourceBundle.getString("FailedText") + " " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void makeUlFile() throws Exception {
|
||||
byte[] config = ulConfiguration.generateUlConfig();
|
||||
|
||||
RandomAccessFile raf = new RandomAccessFile(ulLocation+File.separator+"ul.cfg", "rw");
|
||||
try (RandomAccessFile raf = new RandomAccessFile(ulLocation+File.separator+"ul.cfg", "rw")){
|
||||
raf.seek(raf.length());
|
||||
raf.write(config);
|
||||
raf.close();
|
||||
}
|
||||
}
|
||||
|
||||
private void splitToChunks() throws Exception{
|
||||
|
@ -109,8 +118,7 @@ public class UlMaker implements Runnable{
|
|||
main_loop:
|
||||
for (int chunkNumber = 0; ; chunkNumber++){
|
||||
String pathname = String.format(locationPattern, chunkNumber);
|
||||
BufferedOutputStream fragmentBos = new BufferedOutputStream(Files.newOutputStream(Paths.get(pathname)));
|
||||
|
||||
try (BufferedOutputStream fragmentBos = new BufferedOutputStream(Files.newOutputStream(Paths.get(pathname)))){
|
||||
long counter = 0;
|
||||
|
||||
while (counter < 256){
|
||||
|
@ -130,7 +138,7 @@ public class UlMaker implements Runnable{
|
|||
counter++;
|
||||
updater.updateProgressBySize(readBytesCount);
|
||||
}
|
||||
fragmentBos.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,3 +21,4 @@ ISO_NotSupportedCdDvd=Not supported CD/DVD format
|
|||
ISO_CantReadRootDescriptor=Can't read CD/DVD directory entry for the root directory
|
||||
ISO_NoSystemCnf=SYSTEM.CNF not found in this CD/DVD. Is it a PS2 Disk?
|
||||
ISO_PublisherTitleNotFound=Title not found. SYSTEM.CNF file is next:
|
||||
PleaseWaitText=Please wait while useless file fragments removing...
|
||||
|
|
|
@ -21,3 +21,4 @@ ISO_NotSupportedCdDvd=\u041D\u0435\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u04
|
|||
ISO_CantReadRootDescriptor=\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u043F\u0440\u043E\u0447\u0435\u0441\u0442\u044C \u0437\u0430\u043F\u0438\u0441\u044C \u043A\u043E\u0440\u043D\u0435\u0432\u043E\u0433\u043E \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0430 CD/DVD \u0434\u0438\u0441\u043A\u0430
|
||||
ISO_NoSystemCnf=\u041D\u0430 \u044D\u0442\u043E\u043C CD/DVD \u043D\u0435\u0442 \u0444\u0430\u0439\u043B\u0430 SYSTEM.CNF. \u042D\u0442\u043E \u0442\u043E\u0447\u043D\u043E \u0434\u0438\u0441\u043A \u0434\u043B\u044F PS2?
|
||||
ISO_PublisherTitleNotFound=\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E. SYSTEM.CNF \u0432\u044B\u0433\u043B\u044F\u0434\u0438\u0442 \u0442\u0430\u043A:
|
||||
PleaseWaitText=\u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u043F\u043E\u0434\u043E\u0436\u0434\u0438\u0442\u0435 \u043F\u043E\u043A\u0430 \u0443\u0434\u0430\u043B\u044F\u044E\u0442\u0441\u044F \u043D\u0435\u043D\u0443\u0436\u043D\u044B\u0435 \u0444\u0440\u0430\u0433\u043C\u0435\u043D\u0442\u044B \u0444\u0430\u0439\u043B\u0430...
|
||||
|
|
Loading…
Reference in a new issue