bsod 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83beb199c8b301c36044e06144b6ca921c64642a
4
- data.tar.gz: ac15dd7fe9f3c3059d3c2c70b33184b4dce8d77a
3
+ metadata.gz: ee3f47fca59ed812c893b1782ccaec0220ed3e6c
4
+ data.tar.gz: 54bb24834166e361b54b27af9e78a6baede5ca5d
5
5
  SHA512:
6
- metadata.gz: 81da1642f9c41bb899bb69e6894c732f2d2c213ae7956a30ca98099c4aae36486e31ddbe9f6ba531be6279adbdbb1bc19e3444036ca7b7eb54db8848ae25c0fe
7
- data.tar.gz: 5a8078dd20328035bc47c7161b547d7693461cdbf20a55e2c32e824763ebef5eaf3a76bac34bfa3c854609f0f87c0641d240aa097aeec0b6fdc815c9a085cc2c
6
+ metadata.gz: b019f93776d8cbcf56ffeb22a3995d26330ec3c817a8dfdf166910a7056db45da6f4933250eaa0061bd59da39a230215c20fb2929d59bcebec2bb18acc0d5c7f
7
+ data.tar.gz: c1f89d815ec11d12c5725d168a1ac63a53592d9cdbd830cb8707e883011638d6252abe71ebccbcf23eb81aa158515de7d3d6bab43f77a7d7323277168afd0f0c
data/.gitignore CHANGED
@@ -1,3 +1,7 @@
1
1
  *.ttf
2
2
  *.txt
3
3
  *.gem
4
+
5
+ # I'm saving them for historical reasons
6
+ old-gems
7
+
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  <!-- My awesome changelog -->
2
2
 
3
+ ## 1.0.0 (Oct 20, 2013)
4
+
5
+ * Changed library API and executable commandline flags.
6
+ * Added way to easily add new BSODs and included some
7
+ more by default.
8
+
3
9
  ## 0.1.0 (Oct 14, 2013)
4
10
 
5
11
  * Added both `LICENSE` (`bsod` license file) and
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # bsod
2
2
 
3
- Simulates a [Blue Screen of Death](https://en.wikipedia.org/wiki/Blue_screen_of_death), as seen on Micro$oftWindow$.
3
+ ![bsod](images/bsod.png)
4
+
5
+ Simulates [Blue Screens of Death](https://en.wikipedia.org/wiki/Blue_screen_of_death) from
6
+ several systems, primarily Micro$oftWindow$. It's made in a way that eases
7
+ adding new BSODs.
4
8
 
5
9
  As an executable, has optional flag to sleep before BSODing so you can surprise
6
10
  your friends!
@@ -12,22 +16,26 @@ As a library, you can integrate a BSOD on any SDL surface.
12
16
  ### Executable
13
17
 
14
18
  $ bsod
15
- $ bsod --sleep 3.1415 # sleep before BSODing
16
- $ bsod --no-fullscreen
19
+ $ bsod --wait 3.1415 # waits seconds before BSODing
20
+ $ bsod --style windowsxp # explicitly selects BSOD style
21
+ $ bsod --list # show supported systems
17
22
 
18
23
  For more see `bsod --help`.
19
24
 
20
25
  ### Library
21
26
 
22
27
  require 'bsod'
28
+ # after initializing sdl properly
23
29
  screen = SDL::Screen.get
24
- BSOD::run(screen, screen.w, screen.h)
30
+ bsod = BSOD::WindowsXP.new
31
+ bsod.draw(screen, screen.w, screen.h)
32
+ BSOD::wait_for_sdl_key # defaults to F8
25
33
 
26
34
  ## Install
27
35
 
28
36
  $ gem install bsod
29
37
 
30
- ## Contact
38
+ ## Credits
31
39
 
32
40
  Hi, I'm Alexandre Dantas! Thanks for having interest in this project. Please
33
41
  take the time to visit any of the links below.
@@ -36,3 +44,8 @@ take the time to visit any of the links below.
36
44
  * Contact: `eu @ alexdantas.net`
37
45
  * My homepage: http://www.alexdantas.net
38
46
 
47
+ Huge thanks to `xscreensaver` and it's `bsod` screensaver. Took inspiration and
48
+ several BSODs from there, adapting to Ruby/SDL. Originally written by Jamie
49
+ Zawinski <jwz@jwz.org> in 1998, with contribution from many others. It's also
50
+ based on the concept by Stephen Martin <smartin@mks.com>.
51
+
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
1
 
2
- require 'bsod/version'
3
-
4
2
  # Adding lib directory to load path
5
3
  lib = File.expand_path('../lib', __FILE__)
6
4
  $:.unshift lib unless $:.include? lib
7
5
 
6
+ require 'bsod/version'
7
+
8
8
  desc "Builds the gem"
9
9
  task :build do
10
10
  system 'gem build bsod.gemspec'
@@ -15,3 +15,7 @@ task :release => :build do
15
15
  system "gem push bsod-#{BSOD::VERSION}.gem"
16
16
  end
17
17
 
18
+ desc "Executes the program"
19
+ task :run do |args, a|
20
+ system "ruby -Ilib bin/bsod"
21
+ end
data/bin/bsod CHANGED
@@ -1,19 +1,40 @@
1
1
  #!/usr/bin/env ruby
2
+ #
3
+ # Attempts to simulate a Blue Screen of Death (BSOD),
4
+ # optionally with a delay before (in seconds).
5
+ #
6
+ # Make sure you have both the `rubysdl` gem and `SDL`/`SDL_TTF`
7
+ # libraries on your system.
2
8
 
3
9
  require 'bsod'
4
10
  require 'bsod/settings'
11
+ require 'bsod/windowsnt'
12
+ require 'bsod/windows2000'
13
+ require 'bsod/windowsxp'
14
+ require 'bsod/linux-sparc'
5
15
 
6
16
  # Global configuration thingy. See `settings.rb`.
7
17
  $settings = nil
8
18
 
9
- # Starts all things related to SDL for this program to work.
19
+ # Starts all things related to `SDL` for BSODs to work.
20
+ # Returns `SDL`s main drawing screen.
21
+ #
22
+ # Note: This method is only required if you don't do
23
+ # this manually. For most of your custom projects,
24
+ # ignore this.
25
+ # Note: This initializes `SDL` based on the global
26
+ # `$settings` parsed by `Settings` module.
10
27
  #
11
- # Returns SDL's main drawing screen.
12
- def sdl_init
28
+ def self.init_sdl
13
29
  SDL::init(SDL::INIT_VIDEO)
14
30
  SDL::TTF.init
15
- SDL::Mouse.hide
16
31
 
32
+ if not BSOD::sdl_inited?
33
+ puts "Error: SDL Video or SDL::TTF not initialized."
34
+ exit 666
35
+ end
36
+
37
+ SDL::Mouse.hide
17
38
  screen = nil
18
39
 
19
40
  if $settings[:fullscreen]
@@ -38,8 +59,18 @@ begin
38
59
  time = $settings[:sleep_time]
39
60
  sleep time if time
40
61
 
41
- screen = sdl_init
42
- BSOD::run(screen, screen.w, screen.h)
62
+ screen = init_sdl
63
+
64
+ bsod = nil
65
+ case $settings[:bsod_type]
66
+ when "windowsnt" then bsod = BSOD::WindowsNT.new
67
+ when "windows2000" then bsod = BSOD::Windows2000.new
68
+ when "windowsxp" then bsod = BSOD::WindowsXP.new
69
+ when "linux-sparc" then bsod = BSOD::LinuxSPARC.new
70
+ end
71
+
72
+ bsod.draw(screen, screen.w, screen.h)
73
+ BSOD::wait_for_sdl_key $settings[:exit_key]
43
74
 
44
75
  # It automatically ends SDL on exit
45
76
  end
File without changes
data/images/bsod.png ADDED
Binary file
@@ -0,0 +1,78 @@
1
+
2
+ require 'bsod'
3
+
4
+ module BSOD
5
+
6
+ # Remember Window$ 2000?
7
+ #
8
+ # This is the same as WindowsNT, the only thing that
9
+ # changes is the default message.
10
+ class LinuxSPARC
11
+
12
+ BSODTEXT = <<END_OF_TEXT
13
+ Unable to handle kernel paging request at virtual address f0d4a000
14
+ tsk->mm->context = 00000014
15
+ tsk->mm->pgd = f26b0000
16
+ \\|/ ____ \\|/
17
+ "@'/ ,. \\`@"
18
+ /_| \\__/ |_\\
19
+ \\__U_/
20
+ gawk(22827): Oops
21
+ PSR: 044010c1 PC: f001c2cc NPC: f001c2d0 Y: 00000000
22
+ g0: 00001000 g1: ad88208a g2: 589528c3 g3: 4c4eaf60
23
+ g4: f8e9a052 g5: a8fa48c3 g6: 93eeb38e g7: ea90911f
24
+ o0: 6814da2c o1: bcbc439b o2: fbee7b93 o3: 5c92e715
25
+ o4: f4e435d8 o5: c0d794ce sp: 187d9d04 ret_pc: 5766da46
26
+ l0: 3623c157 l1: 8dacaddb l2: e2fb0bcb l3: 61058d7c
27
+ l4: c0e26c5b l5: baf25f79 l6: 9ad3e338 l7: c80f287b
28
+ i0: a5487db7 i1: 2a510244 i2: 90803a7c i3: bfb8cf31
29
+ i4: d0157ffe i5: 54647960 i6: bac6c329 i7: 2b5b54ed
30
+ Instruction DUMP:
31
+ END_OF_TEXT
32
+
33
+ # No `def initialize` on purpose
34
+
35
+ # Draws the BSOD on a SDL's `screen`, bounded by `width` and
36
+ # `height`.
37
+ #
38
+ # It must be a `SDL::Surface` (consequently, a `SDL::Screen`
39
+ # is acceptable too.
40
+ def draw(screen, width, height)
41
+
42
+ # Should I break the program's flow here?
43
+ BSOD::init_sdl if not BSOD::sdl_inited?
44
+
45
+ black = screen.format.map_rgb(0, 0, 0)
46
+ screen.fill_rect(0, 0, width, height, black)
47
+
48
+ # Printing that bizarre text
49
+ font = SDL::TTF.open($settings[:font_filename],
50
+ $settings[:font_size] - 2)
51
+
52
+ font.style = SDL::TTF::STYLE_BOLD if $settings[:font_bold]
53
+
54
+ # need to print at the bottom of the screen
55
+ lines_ammount = height / font.height
56
+
57
+ i = (lines_ammount - BSODTEXT.lines.size)
58
+ BSODTEXT.each_line do |line|
59
+ # This is a little hack to allow printing empty lines.
60
+ # First I remove the '\n' at the end to avoid nasty things
61
+ # and then I append a space, to prevent nil strings.
62
+ line.chomp!
63
+ line += " "
64
+
65
+ font.draw_solid_utf8(screen, line,
66
+ 3, (i * font.height),
67
+ 255, 255, 255)
68
+ i += 1
69
+ end
70
+
71
+ font.close
72
+
73
+ # @note Maybe update only the bounded rectangle?
74
+ SDL::Screen.get.update_rect(0, 0, 0, 0)
75
+ end
76
+ end
77
+ end
78
+
data/lib/bsod/settings.rb CHANGED
@@ -15,6 +15,9 @@ class Settings
15
15
  # Makes possible to sleep for a while before BSODing
16
16
  @settings[:sleep_time] = nil
17
17
 
18
+ # Which BSOD we'll show by default?
19
+ @settings[:bsod_type] = "windowsnt"
20
+
18
21
  # This doesn't matter because it will go fullscreen anyways.
19
22
  # Just change it if looks ugly
20
23
  @settings[:width] = 800
@@ -25,10 +28,10 @@ class Settings
25
28
  @settings[:exit_key] = SDL::Key::F8
26
29
 
27
30
  # This is the default font, distributed with the gem.
28
- # It's `../../droidsansmono.ttf` based on `settings.rb` path.
31
+ # It's `../../fonts/droidsansmono.ttf` based on `settings.rb` path.
29
32
  fontname = File.expand_path("../../", __FILE__)
30
33
  fontname = File.dirname fontname
31
- fontname += "/droidsansmono.ttf"
34
+ fontname += "/fonts/droidsansmono.ttf"
32
35
  @settings[:font_filename] = fontname
33
36
  @settings[:font_size] = 14
34
37
  @settings[:font_bold] = false
@@ -47,14 +50,33 @@ class Settings
47
50
  parser.separator ""
48
51
  parser.separator "Options:"
49
52
 
50
- parser.on("-s", "--sleep N", "Sleep N (float) seconds before BSODing") do |n|
53
+ parser.on("-w", "--wait N", "Waits N (float) seconds before BSODing") do |n|
51
54
  @settings[:sleep_time] = n.to_f
52
55
  end
53
56
 
57
+ parser.on("-s", "--style STYLE", "Select the BSOD style to show. To see all options use `--list`. ") do |type|
58
+ @settings[:bsod_type] = type.to_s
59
+ end
60
+
54
61
  parser.on("--[no-]fullscreen", "Runs on fullscreen mode (default on)") do |f|
55
62
  @settings[:fullscreen] = f
56
63
  end
57
64
 
65
+ # parser.on("-r", "--random", "Select a random BSOD") do
66
+ # DO SOMETHING ABOUT IT
67
+ # end
68
+
69
+ parser.on("-l", "--list", "Show all possible BSODs") do
70
+ puts "Usage: bsod -t [type]"
71
+ puts " where [type] can be:"
72
+ puts
73
+ puts "windowsnt [default]"
74
+ puts "windows2000"
75
+ puts "windowsxp"
76
+ puts "linux-sparc"
77
+ exit
78
+ end
79
+
58
80
  # These options appear if no other is given.
59
81
  parser.on("-h", "--help", "Show this message") do
60
82
  puts parser
data/lib/bsod/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
2
  module BSOD
3
- VERSION = "0.1.0"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
 
@@ -0,0 +1,87 @@
1
+
2
+ require 'bsod'
3
+
4
+ module BSOD
5
+
6
+ # Remember Window$ 2000?
7
+ #
8
+ # This is the same as WindowsNT, the only thing that
9
+ # changes is the default message.
10
+ class Windows2000
11
+
12
+ BSODTEXT = <<END_OF_TEXT
13
+ A problem has been detected and windows has been shut down to prevent damage
14
+ to your computer.
15
+
16
+ If this is the first time you've seen this stop error screen,
17
+ restart your computer. If this screen appears again, follow
18
+ these steps:
19
+
20
+ Check to be sure you have adequate disk space. If a driver is
21
+ identified in the Stop message, disable the driver or check
22
+ with the manufacturer for driver updates. Try changing video
23
+ adapters.
24
+
25
+ Check with your hardware vendor for any BIOS updates. Disable
26
+ BIOS memory options such as caching or shadowing. If you need
27
+ to use Safe Mode to remove or disable components, restart your
28
+ computer, press F8 to select Advanced Startup Options, and then
29
+ select Safe Mode.
30
+
31
+ Technical information:
32
+
33
+ *** STOP: 0x0000007E (0xC0000005,0xF88FF190,0x0xF8975BA0,0xF89758A0)
34
+
35
+
36
+ *** EPUSBDSK.sys - Address F88FF190 base at FF88FE000, datestamp 3b9f3248
37
+
38
+ Beginning dump of physical memory
39
+ Physical memory dump complete.
40
+ Contact your system administrator or technical support group for further
41
+ assistance.
42
+ END_OF_TEXT
43
+
44
+ # No `def initialize` on purpose
45
+
46
+ # Draws the BSOD on a SDL's `screen`, bounded by `width` and
47
+ # `height`.
48
+ #
49
+ # It must be a `SDL::Surface` (consequently, a `SDL::Screen`
50
+ # is acceptable too.
51
+ def draw(screen, width, height)
52
+
53
+ # Should I break the program's flow here?
54
+ BSOD::init_sdl if not BSOD::sdl_inited?
55
+
56
+ # Filling screen with that sweet, sweet blue tone
57
+ blue = screen.format.map_rgb(0, 0, 255)
58
+ screen.fill_rect(0, 0, width, height, blue)
59
+
60
+ # Printing that bizarre text
61
+ font = SDL::TTF.open($settings[:font_filename],
62
+ $settings[:font_size])
63
+
64
+ font.style = SDL::TTF::STYLE_BOLD if $settings[:font_bold]
65
+
66
+ i = 0
67
+ BSODTEXT.each_line do |line|
68
+ # This is a little hack to allow printing empty lines.
69
+ # First I remove the '\n' at the end to avoid nasty things
70
+ # and then I append a space, to prevent nil strings.
71
+ line.chomp!
72
+ line += " "
73
+
74
+ font.draw_solid_utf8(screen, line,
75
+ 3, (i * font.height),
76
+ 255, 255, 255)
77
+ i += 1
78
+ end
79
+
80
+ font.close
81
+
82
+ # @note Maybe update only the bounded rectangle?
83
+ SDL::Screen.get.update_rect(0, 0, 0, 0)
84
+ end
85
+ end
86
+ end
87
+
@@ -0,0 +1,84 @@
1
+
2
+ require 'bsod'
3
+
4
+ module BSOD
5
+
6
+ # Ye olde Window$ NT.
7
+ class WindowsNT
8
+
9
+ # The default white text that will appear over the
10
+ # blue background.
11
+ BSODTEXT = <<END_OF_TEXT
12
+ *** STOP: 0x00000001E (0x00000003,0x00000d0e8,0x0c001201e,0x000c0ffee)
13
+ Unhandled Kernel exception c0000047 from fa8418b4 (00d4a81c0,00028492e)
14
+
15
+ Dll Base Date Stamp - Name Dll Base Date Stamp - Name
16
+ bf7978fb be154c92 - ntoskrnl.exe 7fa3883b 11b92972 - hal.dll
17
+ a519c86a b386ca2c - ncrc710.sys faea83e1 c47447d7 - SCSIPORT.SYS
18
+ 2f983e0b 6e01a9a4 - scsidisk.sys 6a7f9869 45b277c4 - Fastfat.sys
19
+ 94041089 e1a9f5d9 - Floppy.SYS b91218c4 c037818d - Hpfs_Rec.SYS
20
+ 0bb5c0c9 8ca7bd22 - Null.SYS 5496bb5f 1d60d82c - Beep.SYS
21
+ a9b37c3a f70ef21d - i8042prt.SYS 585fd0b5 1e973d5d - SERMOUSE.SYS
22
+ e4965cb7 24a6ec07 - kbdclass.SYS 2925baf7 5cb9a053 - MOUCLASS.SYS
23
+ e54f64c7 f54b26c1 - Videoprt.SYS ad7a85bd 7d2571b9 - NCC1701E.SYS
24
+ 1a119462 e9c098e9 - Vga.SYS e3c5a4a4 f5caa34a - Msfs.SYS
25
+
26
+ Address dword dump Dll Base - Name
27
+ 2fc589eb b483bf92 20677c0a f254e409 5977ffa0 a082a53e : c76875ba - i8042prt.SYS
28
+ 35ec96b5 1dc0af3c 406c655c 5bfbe3fe 8390119a bd653a61 : d17a5ee1 - SCSIPORT.SYS
29
+ d54704c9 c9c43be6 ece08295 e5fd350c f469f913 86a54eeb : 24ed5a16 - ntoskrnl.exe
30
+ 4ade1e66 2639fc5c 4d22f159 94f99371 f9876420 71517f45 : 69048b22 - ntoskrnl.exe
31
+ e3d88756 0e0e2322 2a899667 71dd4f99 9fba9b81 12b84e81 : 23ce15e3 - ntoskrnl.exe
32
+ 981f5fa4 e03f9d34 6ec6e730 31ca1ce6 f75b54b6 d5ba53f6 : a7419dad - ntoskrnl.exe
33
+ 16cfcafd 67eb2c74 9152a8f3 62864c8e 148c9c29 bb4235b5 : 3e24c47e - ntoskrnl.exe
34
+
35
+ Kernel Debugger Using: COM2 (Port 0x2f8, Baud Rate 19200)
36
+ Restart and set the recovery options in the system control panel
37
+ or the /CRASHDEBUG system start option. If this message reappears,
38
+ contact your system administrator or technical support group.
39
+ END_OF_TEXT
40
+
41
+ # No `def initialize` on purpose
42
+
43
+ # Draws the BSOD on a SDL's `screen`, bounded by `width` and
44
+ # `height`.
45
+ #
46
+ # It must be a `SDL::Surface` (consequently, a `SDL::Screen`
47
+ # is acceptable too.
48
+ def draw(screen, width, height)
49
+
50
+ # Should I break the program's flow here?
51
+ BSOD::init_sdl if not BSOD::sdl_inited?
52
+
53
+ # Filling screen with that sweet, sweet blue tone
54
+ blue = screen.format.map_rgb(0, 0, 255)
55
+ screen.fill_rect(0, 0, width, height, blue)
56
+
57
+ # Printing that bizarre text
58
+ font = SDL::TTF.open($settings[:font_filename],
59
+ $settings[:font_size])
60
+
61
+ font.style = SDL::TTF::STYLE_BOLD if $settings[:font_bold]
62
+
63
+ i = 0
64
+ BSODTEXT.each_line do |line|
65
+ # This is a little hack to allow printing empty lines.
66
+ # First I remove the '\n' at the end to avoid nasty things
67
+ # and then I append a space, to prevent nil strings.
68
+ line.chomp!
69
+ line += " "
70
+
71
+ font.draw_solid_utf8(screen, line,
72
+ 3, (i * font.height),
73
+ 255, 255, 255)
74
+ i += 1
75
+ end
76
+
77
+ font.close
78
+
79
+ # @note Maybe update only the bounded rectangle?
80
+ SDL::Screen.get.update_rect(0, 0, 0, 0)
81
+ end
82
+ end
83
+ end
84
+
@@ -0,0 +1,88 @@
1
+
2
+ require 'bsod'
3
+ require 'bsod/windowsnt'
4
+
5
+ module BSOD
6
+
7
+ # As seen on Window$ XP.
8
+ #
9
+ # This is the same as WindowsNT, the only thing that
10
+ # changes is the default message.
11
+ class WindowsXP
12
+
13
+ # The default white text that will appear over the
14
+ # blue background.
15
+ BSODTEXT = <<END_OF_TEXT
16
+ A problem has been detected and windows has been shut down to prvent damage
17
+ to your computer.
18
+
19
+ The problem seems to be caused by the following file: SPCMDCON.SYS
20
+
21
+ PAGE_FAULT_IN_NONPAGED_AREA
22
+
23
+ If this is the first time you've seen this stop error screen,
24
+ restart your computer. If this screen appears again, follow
25
+ these steps:
26
+
27
+ Check to make sure any new hardware or software is properly installed.
28
+ If this is a new installation, ask your hardware or software manufacturer
29
+ for any windows updates you might need.
30
+
31
+ If problems continue, disable or remove any newly installed hardware
32
+ or software. Disable BIOS memory options such as caching or shadowing.
33
+ If you need to use Safe Mode to remove or disable components, restart
34
+ your computer, press F8 to select Advanced Startup Options, and then
35
+ select Safe Mode.
36
+
37
+ Technical information:
38
+
39
+ *** STOP: 0x00000050 (0xFD3094C2,0x00000001,0xFBFE7617,0x00000000)
40
+
41
+
42
+ *** SPCMDCON.SYS - Address FBFE7617 base at FBFE5000, DateStamp 3d6dd67c
43
+ END_OF_TEXT
44
+
45
+ # No `def initialize` on purpose
46
+
47
+ # Draws the BSOD on a SDL's `screen`, bounded by `width` and
48
+ # `height`.
49
+ #
50
+ # It must be a `SDL::Surface` (consequently, a `SDL::Screen`
51
+ # is acceptable too.
52
+ def draw(screen, width, height)
53
+
54
+ # Should I break the program's flow here?
55
+ BSOD::init_sdl if not BSOD::sdl_inited?
56
+
57
+ # Filling screen with that sweet, sweet blue tone
58
+ blue = screen.format.map_rgb(0, 0, 255)
59
+ screen.fill_rect(0, 0, width, height, blue)
60
+
61
+ # Printing that bizarre text
62
+ font = SDL::TTF.open($settings[:font_filename],
63
+ $settings[:font_size])
64
+
65
+ font.style = SDL::TTF::STYLE_BOLD if $settings[:font_bold]
66
+
67
+ i = 0
68
+ BSODTEXT.each_line do |line|
69
+ # This is a little hack to allow printing empty lines.
70
+ # First I remove the '\n' at the end to avoid nasty things
71
+ # and then I append a space, to prevent nil strings.
72
+ line.chomp!
73
+ line += " "
74
+
75
+ font.draw_solid_utf8(screen, line,
76
+ 3, (i * font.height),
77
+ 255, 255, 255)
78
+ i += 1
79
+ end
80
+
81
+ font.close
82
+
83
+ # @note Maybe update only the bounded rectangle?
84
+ SDL::Screen.get.update_rect(0, 0, 0, 0)
85
+ end
86
+ end
87
+ end
88
+
data/lib/bsod.rb CHANGED
@@ -1,91 +1,31 @@
1
1
 
2
2
  require 'sdl'
3
3
 
4
- # Attempts to simulate a Blue Screen of Death, optionally
5
- # with a delay before (in seconds).
4
+ # This is a great container over all Blue Screens
5
+ # of Death (BSOD).
6
+ #
7
+ # Every BSOD must implement a `draw` method, that will
8
+ # render itself over any `SDL::Surface`.
6
9
  #
7
- # Make sure you have installed:
8
- # * ruby `sdl` gem
9
- # * C `SDL` library
10
- # * C `SDL_ttf` library
11
10
  module BSOD
12
11
 
13
- # This is the full text to be displayed onscreen.
14
- # Change it to your heart's content!
15
- BSODTEXT = <<END_OF_TEXT
16
- *** STOP: 0x00000001E (0x00000003,0x00000d0e8,0x0c001201e,0x000c0ffee)
17
- Unhandled Kernel exception c0000047 from fa8418b4 (00d4a81c0,00028492e)
18
-
19
- Dll Base Date Stamp - Name Dll Base Date Stamp - Name
20
- bf7978fb be154c92 - ntoskrnl.exe 7fa3883b 11b92972 - hal.dll
21
- a519c86a b386ca2c - ncrc710.sys faea83e1 c47447d7 - SCSIPORT.SYS
22
- 2f983e0b 6e01a9a4 - scsidisk.sys 6a7f9869 45b277c4 - Fastfat.sys
23
- 94041089 e1a9f5d9 - Floppy.SYS b91218c4 c037818d - Hpfs_Rec.SYS
24
- 0bb5c0c9 8ca7bd22 - Null.SYS 5496bb5f 1d60d82c - Beep.SYS
25
- a9b37c3a f70ef21d - i8042prt.SYS 585fd0b5 1e973d5d - SERMOUSE.SYS
26
- e4965cb7 24a6ec07 - kbdclass.SYS 2925baf7 5cb9a053 - MOUCLASS.SYS
27
- e54f64c7 f54b26c1 - Videoprt.SYS ad7a85bd 7d2571b9 - NCC1701E.SYS
28
- 1a119462 e9c098e9 - Vga.SYS e3c5a4a4 f5caa34a - Msfs.SYS
29
-
30
- Address dword dump Dll Base - Name
31
- 2fc589eb b483bf92 20677c0a f254e409 5977ffa0 a082a53e : c76875ba - i8042prt.SYS
32
- 35ec96b5 1dc0af3c 406c655c 5bfbe3fe 8390119a bd653a61 : d17a5ee1 - SCSIPORT.SYS
33
- d54704c9 c9c43be6 ece08295 e5fd350c f469f913 86a54eeb : 24ed5a16 - ntoskrnl.exe
34
- 4ade1e66 2639fc5c 4d22f159 94f99371 f9876420 71517f45 : 69048b22 - ntoskrnl.exe
35
- e3d88756 0e0e2322 2a899667 71dd4f99 9fba9b81 12b84e81 : 23ce15e3 - ntoskrnl.exe
36
- 981f5fa4 e03f9d34 6ec6e730 31ca1ce6 f75b54b6 d5ba53f6 : a7419dad - ntoskrnl.exe
37
- 16cfcafd 67eb2c74 9152a8f3 62864c8e 148c9c29 bb4235b5 : 3e24c47e - ntoskrnl.exe
38
-
39
- Kernel Debugger Using: COM2 (Port 0x2f8, Baud Rate 19200)
40
- Restart and set the recovery options in the system control panel
41
- or the /CRASHDEBUG system start option. If this message reappears,
42
- contact your system administrator or technical support group.
43
- END_OF_TEXT
44
-
45
- # Runs the BSOD on a SDL's `screen`, bounded by `width` and
46
- # `height`.
47
- #
48
- # It must be a `SDL::Surface` (consequently, a `SDL::Screen` is
49
- # acceptable too.
50
- def self.run(screen, width, height)
51
12
 
13
+ # Tells if SDL has been initialized already, both
14
+ # by us (`init_sdl`) or by the user.
15
+ def self.sdl_inited?
52
16
  if (SDL::inited_system(SDL::INIT_VIDEO) == 0) or
53
- (not SDL::TTF::init?)
54
- puts "Error: SDL Video or SDL::TTF not initialized."
55
- exit 666
56
- end
57
-
58
- # Filling screen with that sweet, sweet blue tone
59
- blue = screen.format.map_rgb(0, 0, 255)
60
- screen.fill_rect(0, 0, width, height, blue)
61
-
62
- # Printing that bizarre text
63
- font = SDL::TTF.open($settings[:font_filename],
64
- $settings[:font_size])
65
-
66
- font.style = SDL::TTF::STYLE_BOLD if $settings[:font_bold]
67
-
68
- i = 0
69
- BSODTEXT.each_line do |line|
70
- # This is a little hack to allow printing empty lines.
71
- # First I remove the '\n' at the end to avoid nasty things
72
- # and then I append a space, to prevent nil strings.
73
- line.chomp!
74
- line += " "
75
-
76
- font.draw_solid_utf8(screen, line,
77
- 3, (i * font.height),
78
- 255, 255, 255)
79
- i += 1
17
+ (not SDL::TTF::init?)
18
+ return false
80
19
  end
81
20
 
82
- font.close
83
-
84
- # @note Maybe update only the bounded rectangle?
85
- SDL::Screen.get.update_rect(0, 0, 0, 0)
21
+ return true
22
+ end
86
23
 
87
- # This basically waits for keypresses and ignores everything
88
- # except for that special key you've defined.
24
+ # Waits for a keypress of `SDL_KEY` `key`, ignoring
25
+ # anything else.
26
+ #
27
+ # Defaults to F8.
28
+ def self.wait_for_sdl_key(key=SDL::Key::F8)
89
29
  loop = true
90
30
  while loop
91
31
 
@@ -95,7 +35,7 @@ END_OF_TEXT
95
35
  case event
96
36
  when SDL::Event2::KeyDown
97
37
  SDL::Key.scan
98
- if SDL::Key.press? $settings[:exit_key]
38
+ if SDL::Key.press? key
99
39
  loop = false
100
40
  end
101
41
  end
@@ -104,5 +44,9 @@ END_OF_TEXT
104
44
  sleep 0.05
105
45
  end
106
46
  end
47
+
48
+ def self.init_curses
49
+
50
+ end
107
51
  end
108
52
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bsod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Dantas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-14 00:00:00.000000000 Z
11
+ date: 2013-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -61,10 +61,15 @@ files:
61
61
  - Rakefile
62
62
  - bin/bsod
63
63
  - bsod.gemspec
64
- - droidsansmono.ttf
64
+ - fonts/droidsansmono.ttf
65
+ - images/bsod.png
65
66
  - lib/bsod.rb
67
+ - lib/bsod/linux-sparc.rb
66
68
  - lib/bsod/settings.rb
67
69
  - lib/bsod/version.rb
70
+ - lib/bsod/windows2000.rb
71
+ - lib/bsod/windowsnt.rb
72
+ - lib/bsod/windowsxp.rb
68
73
  homepage: http://www.alexdantas.net/projects/bsod
69
74
  licenses:
70
75
  - GPL-3.0